Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

hrh747's avatar
hrh747
Helpful | Level 5
5 years ago
Solved

File transfer API

Hi,

I started to become familiar with the Dropbox API (Python). I am looking for the API that will transfer a file from my Windows 10 machine to my Dropbox account. Looking at this sample code on the Dropbox website to backup a file:

with open(LOCALFILE, 'rb') as f:
# We use WriteMode=overwrite to make sure that the settings in the file
# are changed on upload
print("Uploading " + LOCALFILE + " to Dropbox as " + BACKUPPATH + "...")
try:
dbx.files_upload(f.read(), BACKUPPATH, mode=WriteMode('overwrite'))
except ApiError as err:
...........

Is there another API that does file transfer, or this is how the file transfer is carried out by reading bytes from the source and writing to the destination (Just want to make sure I am not missing something)?

 

Thanks in advance

  • The files_upload method is the right way to use the Dropbox API via the Python SDK to send some file data to the Dropbox servers and save it as a file in the connected Dropbox account. (Note that it only supports files up to 150 MB in size; for larger files, use upload sessions.)

2 Replies

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    5 years ago

    The files_upload method is the right way to use the Dropbox API via the Python SDK to send some file data to the Dropbox servers and save it as a file in the connected Dropbox account. (Note that it only supports files up to 150 MB in size; for larger files, use upload sessions.)

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!