cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox 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: 

Re: API Upload Always Zero

API Upload Always Zero

jimbob1977
Helpful | Level 6
Go to solution

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

jimbob1977
Helpful | Level 6
Go to solution

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

Greg-DB
Dropbox Staff
Go to solution

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.

jimbob1977
Helpful | Level 6
Go to solution

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

 

Здравко
Legendary | Level 20
Go to solution

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

jimbob1977
Helpful | Level 6
Go to solution

Hi All

Thanks for your help.

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

 

Thanks Again

Need more support?