cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Tell us what you want to see on the Community here!
Close

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: 

API Upload Always Zero

Highlighted

API Upload Always Zero

Helpful | Level 6

Hi

When I upload a file using the code below the file appears in my folder at zero size.

Uploading the file manually works fine. so I know the file is ok

I've looked thru similar old posts but I'm still struggling - any advice??

 

curl -X POST https://content.dropboxapi.com/2/files/upload \
  --header 'Authorization: Bearer MYTOKEN' \
  --header 'Content-Type: application/octet-stream' \
  --header 'Dropbox-API-Arg: {"path":"/RoomVT/Clown2.jpeg"}' 
  --data-binary @"/Splash.jpeg"
1 Accepted Solution

Accepted Solutions
Highlighted

Re: API Upload Always Zero

Helpful | Level 6

Hi All

Thanks for your help.

My fault - I had an error in the file path to Data Binary

 

Thanks Again

View solution in original post

4 Replies 4
Highlighted

Re: API Upload Always Zero

Dropboxer

It looks like you don't have a continuation "\" on the second to last line, like there is on the other lines, so the last line may not actually be given to curl which would result in no data being upload. Try adding that "\" back.

Highlighted

Re: API Upload Always Zero

Helpful | Level 6

Hi 

So First I Tried This (Adding The /)

 

curl -X POST https://content.dropboxapi.com/2/files/upload \
  --header 'Authorization: Bearer MYTOKEN' \
  --header 'Content-Type: application/octet-stream' \
  --header 'Dropbox-API-Arg: {"path":"/RoomVT/Clown2.jpeg"}'\ 
  --data-binary @"/Splash.jpeg"

This Gave The Response.

-bash: --data-binary: command not found

 

So I Put A Space Between ' & \ To Give.

 

curl -X POST https://content.dropboxapi.com/2/files/upload \
  --header 'Authorization: Bearer MYTOKEN' \
  --header 'Content-Type: application/octet-stream' \
  --header 'Dropbox-API-Arg: {"path":"/RoomVT/Clown2.jpeg"}' \ 
  --data-binary @"/Splash.jpeg"

Now I Get The Response

 

curl: (6) Could not resolve host: 

 

Both Add The File But Both At Zero Content????

 

Highlighted

Re: API Upload Always Zero

Super Collaborator | Level 20

Hi @jimbob1977,

What are results from following commands:

host content.dropboxapi.com
stat /Splash.jpeg

If the above commands results are as expected, probably you have messed up curl command arguments. Try to put everything on a single line:

curl -X POST https://content.dropboxapi.com/2/files/upload -H 'Authorization: Bearer MYTOKEN' -H 'Content-Type: application/octet-stream' -H 'Dropbox-API-Arg: {"path":"/RoomVT/Clown2.jpeg"}' --data-binary @/Splash.jpeg

If some error brings up again, post entire error, not just part (i.e. which host couldn't be resolved, for example).

Highlighted

Re: API Upload Always Zero

Helpful | Level 6

Hi All

Thanks for your help.

My fault - I had an error in the file path to Data Binary

 

Thanks Again

View solution in original post

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?