diff --git a/users/views.py b/users/views.py index 9db2d71..7d40028 100644 --- a/users/views.py +++ b/users/views.py @@ -742,16 +742,18 @@ def support(request): if request.method == 'POST': form = request.POST - + fileblob = "" attachments=[] #myfile is the key of a multi value dictionary, values are the uploaded files for f in request.FILES.getlist('attachment_1'): #myfile is the name of your html file button filename = f.name attachment_type = filetype.guess(f) - fileblob = str(base64.b64encode(f.read())) + fileblob = str(base64.b64encode(f.read())) fileblob = fileblob[1 : : ] fileblob = fileblob[1 : : ] fileblob = fileblob[:-1:] attachments.append({str(filename) : "data:" + attachment_type.mime + ";base64," + fileblob}) + fileblob = "data:" + attachment_type.mime + ";base64," + fileblob + for f in request.FILES.getlist('attachment_2'): #myfile is the name of your html file button filename = f.name attachment_type = filetype.guess(f) @@ -795,6 +797,8 @@ def support(request): } json_data = json.dumps(ostdata) + + print(json_data) r = requests.post("https://support.vh-solutions.de/api/http.php/tickets.json", data=json_data, headers=headers) # IF request FAILED error-Message