diff --git a/alkatorapi/views.py b/alkatorapi/views.py index c16f94a..970f25a 100644 --- a/alkatorapi/views.py +++ b/alkatorapi/views.py @@ -200,8 +200,8 @@ def photos(request): def upload_files(request): for name, file in request.FILES.items(): print(name) - rand = random.randint(0, 9999999999999) - random_name = f'photos/uploads/{rand}.jpg' + rand = random.randint(0, 99999) + random_name = f'photos/uploads/{rand}{file.name}' with open(random_name, "wb+") as destination: for chunk in file.chunks(): destination.write(chunk)