cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Great and all as it is to hear how we use Dropbox, we want to know how you use it! Day to day, big projects, sharing files with friends and family - we want to know about it.

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 zip file via Dropbox Api and curl

Upload zip file via Dropbox Api and curl

AndrewRadchenko
New member | Level 2

I'm trying to upload .zip file using

Curl request:

curl -X POST https://content.dropboxapi.com/2/files/upload \
--header "Authorization: Bearer <Access Token>" \
--header "Dropbox-API-Arg: {\"path\": \"/upload.zip\"}" \
--header "Content-Type: application/octet-stream" \
--data-binary @/upload.zip

Uploading completed without errors. Downloading from another device (Ubuntu server) is also completed. But when I'm trying to unzip I get bellow error:

Archive:  upload.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of upload.zip or
        upload.zip.zip, and cannot find upload.zip.ZIP, period.

Something is not correct in my curl upload configuration I guess. Probably, there are some special config to upload and download .zip files.

What I'm doing wrong? How to upload .zip file via dropbox api in the reight way?

 

1 Accepted Solution

Accepted Solutions

Re: Upload zip file via Dropbox Api and curl

AndrewRadchenko
New member | Level 2

As most of unworking situation, you have to check your code and syntax...

1) file path shall be inside quotes: 

--data-binary @"/upload.zip"

2) download path shall start with slash:

curl -X POST https://content.dropboxapi.com/2/files/download \
--header "Authorization: Bearer <Token>" \
--header "Dropbox-API-Arg: {\"path\": \"/directory/upload.zip\"}" >>upload.zip

Generaly it's a good idea to check, if downloaded zip file hase the right file size. If file size is not the same as in local storage so uploading was not finished successfully.  

View solution in original post

2 Replies 2

Re: Upload zip file via Dropbox Api and curl

AndrewRadchenko
New member | Level 2

As most of unworking situation, you have to check your code and syntax...

1) file path shall be inside quotes: 

--data-binary @"/upload.zip"

2) download path shall start with slash:

curl -X POST https://content.dropboxapi.com/2/files/download \
--header "Authorization: Bearer <Token>" \
--header "Dropbox-API-Arg: {\"path\": \"/directory/upload.zip\"}" >>upload.zip

Generaly it's a good idea to check, if downloaded zip file hase the right file size. If file size is not the same as in local storage so uploading was not finished successfully.  

Re: Upload zip file via Dropbox Api and curl

Greg-DB
Dropboxer

[Cross-linking for reference: https://stackoverflow.com/questions/55776674/upload-zip-file-via-dropbox-api-and-curl ]

I'm glad to see you already worked this out!

Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropboxer
  • User avatar
    AndrewRadchenko New member | Level 2
What do Dropbox user levels mean?
Need more support?