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

bbroscheit's avatar
bbroscheit
Explorer | Level 3
11 months ago

the files I upload with the api arrive corrupted

Hello, my name is Bernardo, I am wanting to implement the Dropbox API to a support system. I use the example that dropbox gives on github to upload files, in my code it works but when I enter the dro...
  • Greg-DB's avatar
    11 months ago

    When uploading files to Dropbox via the Dropbox API, Dropbox will save whatever data you supply, so you'll need to make sure you're sending the exact correct data you want saved. In your code, I see you're calling the filesUpload method to upload the file. When doing so, you supply the data you want to upload in the 'contents' parameter.

     

    In your code, you're sending the contents of the 'e' variable to that 'contents' parameter. You'll need to make sure that the data you're sending there is exactly and only the data for the file you're uploading. The 'e' variable in your code comes from the .map on your 'files' variable, but the code doesn't show where/how the 'files' variable is defined. You'll need to debug and update your code accordingly to make sure you pass in just the desired file data. (For instance, based on the other 'e.filename' usage of the 'e' variable, it looks like 'e' probably doesn't contain just the file data, but rather is an object containing some properties.)

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,885 PostsLatest Activity: 13 hours ago
326 Following

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 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!