One month down in 2025: How are your resolutions coming along? Check out how to get back on track here.
Forum Discussion
hzy916
7 years agoExplorer | Level 3
Upload pdf(using swift sdk) is damaged when downloading from dropbox
I am following the instructions on https://github.com/dropbox/SwiftyDropbox#download-style-request
and I successfully upload my pdf to dropbox. However the uploaded pdf cannot be previewed and when I download, it shows the following error.
I tired to upload the same pdf manually to dropbox. I can preview and when I download it, it is completely correct.
This is how I upload my pdf using swift.
Appreciate anyone's help! Thank you very much. I have been stuck for a long time
- chirstius
Dropbox Staff
Hello hzy916,
I think the issue here is that you're trying to encode the PDF file as if it were text data and not binary data.
Try creating a URL to the local file path and updating your request to point the 'input' parameter directly to that URL.
See if that works as expected.
-Chuck
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,950 PostsLatest Activity: 2 hours ago
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!