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
fenario
7 years agoExplorer | Level 3
golang file upload
Hi, I was able to upload a file using golang using this: var ( body = &bytes.Buffer{} writer = multipart.NewWriter(body) ) b := dropboxAPI{ ...
Greg-DB
7 years agoDropbox Staff
It looks like the HTTP headers were incorrectly added to the file data. First, I recommend determining if this happened during your upload, or your download.
The headers in the screenshot you shared don't seem to match the headers in your upload code, so I suspect the issue using occurring during the download. Are you using custom code to download the file, e.g., as opposed to downloading manually via the web site? If you're downloading via code, it may be good to download from the web site to compare.
In either case, we can't offer help with using whatever third party HTTP client you're using in Go, so you may want to refer to its documentation.
When uploading, the file data should be passed in the HTTP request body, so you'll need to make sure that the HTTP request is properly formatted, with the headers properly separated from the body, and not included in the body itself.
When downloading, the file data is returned in the HTTP response body. When saving the file, you should make sure you only save the response body, and not the response headers. Most HTTP clients offer an easy way to do this, but you may need to refer to the client's documentation to be sure.
The headers in the screenshot you shared don't seem to match the headers in your upload code, so I suspect the issue using occurring during the download. Are you using custom code to download the file, e.g., as opposed to downloading manually via the web site? If you're downloading via code, it may be good to download from the web site to compare.
In either case, we can't offer help with using whatever third party HTTP client you're using in Go, so you may want to refer to its documentation.
When uploading, the file data should be passed in the HTTP request body, so you'll need to make sure that the HTTP request is properly formatted, with the headers properly separated from the body, and not included in the body itself.
When downloading, the file data is returned in the HTTP response body. When saving the file, you should make sure you only save the response body, and not the response headers. Most HTTP clients offer an easy way to do this, but you may need to refer to the client's documentation to be sure.
- fenario7 years agoExplorer | Level 3
I'm manually downloading. So, its definitely in the uploading process. I will look into this further. Thanks for the help
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,915 PostsLatest Activity: 6 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!