We Want to Hear From You! What Do You Want to See on the Community? Tell us here!
Forum Discussion
mmteam
9 years agoHelpful | Level 5
Upload Image with Dropbox API
I am not able to upload the image file content in a correct way.
the file is uploaded but content is corrupted..
Here is my code
OrderedHashJava headers = this.getCustomHeader(this.getAccessToken());
headers.put(HEADERS.DROPBOX_API_SELECT_USER,u.getDropboxTeamMemeberID());
headers.put(HEADERS.CONTENT_TYPE, "application/octet-stream");
headers.put(HEADERS.DROPBOX_API_ARGUMENT, requestBody);
byte[] bytes = this.getFileContent(file.getId());
rtn = GeneralUtil.sendHttpPostRequestByteBody(uploadURL, "", "", bytes, headers);
i am passing bytes and the file is uploaded but content is corrupt in that image file why????
The Api Says we have to send data in this manner
curl -X POST https://api.dropboxapi.com/2-beta-2/files/upload \
--header "Authorization: Bearer <access-token>" \
--header "Content-Type: application/octet-stream" \
--header "Dropbox-API-Arg: {\"path\": \"/cupcake.png\", \"mode\": \"overwrite\"}" \
--data-binary LOCAL-file.png
what is LOCAL-file.png
how to create data-binary as i am sending through bytes
can anybody give me solutions .
it is urgent
Found solution by changing bytes value for httppost request
1 Reply
Replies have been turned off for this discussion
- mmteam9 years agoHelpful | Level 5
Found solution by changing bytes value for httppost request
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,036 PostsLatest Activity: 9 months ago
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
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!