cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Image brokes when I upload files with http

Image brokes when I upload files with http

daniilkurlovich
New member | Level 2

Hi, i got a problem with upload images in dropbox. Check my code

1.png

Other files are transmitted and i can read after upload in dropbox.

But in images files written 'This file is not available for preview.' 

1 Reply 1

Greg-DB
Dropbox Staff

[Cross-linking for reference: https://stackoverflow.com/questions/53488348/image-brokes-when-i-upload-files-with-http ]

You're using the "files" parameter in the Python requests library "post" method, which seems to be for "multipart encoding upload". The Dropbox API /2/files/upload endpoint does not use multipart encoding upload, however, and instead just expects the raw file content to be sent in the request body (to match the "Content-Type: application/octet-stream"). 

Update your code to use the "data" parameter to send the file data in the request body instead.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?