drop box small files upload slowly

32 Views Asked by At

I have a free dropbox subscription and use it in conjunction with django.

def upload_image(request):
    if request.method == 'POST':
        dbx = dropbox.Dropbox('')
        file_from = request.FILES['file']
        file_to = '/chat/' + file_from.name 

        # Upload the file
        dbx.files_upload(file_from.read(), file_to)

        # Create a shared link for the uploaded file
        shared_link_metadata = dbx.sharing_create_shared_link_with_settings(file_to)
        url = shared_link_metadata.url

        # Replace ?dl=0 with ?raw=1 in the URL
        url = url.replace('&dl=0', '&raw=1')

        # Create a new Image instance with the shared link
        new_image = Image(image_url=url)
        new_image.save()

        return HttpResponse("Image uploaded and saved successfully!")
    else:
        return HttpResponse("Method not allowed", status=405)

I have read a lot that uploading large files can be slow however my current upload speed for a file for example ~2MB takes ~3 seconds. From what I've learnt dropbox has no speed settings and tries to upload as fast as possible. However maybe I am still missing something in the app settings?

0

There are 0 best solutions below