cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
If you’ve changed your email address, now's the perfect time to update it on your Dropbox account and we’re here to help! Learn 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: 

PDF content gets corrupted after "filesUpload"

PDF content gets corrupted after "filesUpload"

thediez
Explorer | Level 3

Hi,

I am trying to upload a pdf with valid content from mobile device to Dropbox but having trouble with the uploaded file that seems to get corrupted while being uploaded. It is a React Native (Expo) app. 

Please refer to the attachment for the code that I am using.

I have also tried to download the file and open it in Notepad++ and can see its content (see attached).

What's that I am wrong? I have tried to send the content to "filesupload" as binary as well but the uploaded pdf file is still corrupted.

Many thanks in advance.

Untitled2.png

Untitled.png

 

 

1 Reply 1

Greg-DB
Dropbox Staff

When uploading files to Dropbox, you should just supply the raw binary data. In the code here, there are two things that look like they may be altering or affecting the format of the data you're sending: 1) 'base64: true' on your printToFileAsync method and 2) readAsStringAsync. Those methods aren't made by Dropbox though so I can't say what exactly they do or offer guidance on those, so I recommend referring to the documentation for those for information on using them accordingly.

Need more support?
Who's talking

Top contributors to this post

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