You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
jmccolgan93
5 years agoExplorer | Level 3
Uploaded Files are Currupt (Flask, Python)
Hey, guys so I'm experimenting with the Dropbox python API using Flask. I managed to upload files but all the files I've uploaded are only 16 bytes in size and are unable to be opened. here's the cod...
- 5 years ago
Hi!
When you call
file_upload
, you're actually uploading the file's name as a string. Each file is coming out to 16 bytes because the strings are being generated bysecure_filename
and are probably a standard length.You can fix it by changing the first variable you're passing to
file_upload
.dbx_client.files_upload(f.encode(), path)
should be
dbx_client.files_upload(uploadedfile.encode(), path)
It looks like you're just working with the filename
TaylorKrusen
5 years agoDropbox Staff
Hi!
When you call file_upload
, you're actually uploading the file's name as a string. Each file is coming out to 16 bytes because the strings are being generated by secure_filename
and are probably a standard length.
You can fix it by changing the first variable you're passing to file_upload
.
dbx_client.files_upload(f.encode(), path)
should be
dbx_client.files_upload(uploadedfile.encode(), path)
It looks like you're just working with the filename
- jmccolgan935 years agoExplorer | Level 3
thanks man! i had to change "encode()" for "read()" thanks for the help man!
dbx_client.files_upload(uploadedfile.read(), path)
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,882 PostsLatest Activity: 3 years agoIf 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 or Facebook.
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!