remove the need for ftp server

This commit is contained in:
Bryan Gerlach
2024-11-05 13:58:14 -06:00
parent bace58ac1f
commit bfadbb8cd5
4 changed files with 55 additions and 25 deletions

View File

@@ -338,4 +338,15 @@ def save_png(file, uuid, domain):
imageJson['uuid'] = uuid
imageJson['file'] = quote(file.name)
#return "%s/%s" % (domain, file_save_path)
return json.dumps(imageJson)
return json.dumps(imageJson)
def save_custom_client(request):
file = request.FILES['file']
myuuid = request.POST.get('uuid')
file_save_path = "exe/%s/%s" % (myuuid, file.name)
Path("exe/%s" % myuuid).mkdir(parents=True, exist_ok=True)
with open(file_save_path, "wb+") as f:
for chunk in file.chunks():
f.write(chunk)
return HttpResponse("File saved successfully!")