cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and 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: 

Upload Image with Dropbox API

Upload Image with Dropbox API

mmteam
Helpful | Level 5
Go to solution

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

 

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

1 Accepted Solution

Accepted Solutions

mmteam
Helpful | Level 5
Go to solution

Found solution by changing bytes value for httppost request

View solution in original post

1 Reply 1

mmteam
Helpful | Level 5
Go to solution

Found solution by changing bytes value for httppost request

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    mmteam Helpful | Level 5
What do Dropbox user levels mean?