Error while using file upload API - Content-Length not specified
I'm trying the cURL script to upload a file and I'm getting the following error:
No Content LengthNo Content Length
Description: Could not process this request because there was no Content-Length specified.
curl: (6) Could not resolve host: -H curl: (3) Port number ended with ' ' curl: (6) Could not resolve host: -F curl: (3) [globbing] nested brace in column 44 curl: (6) Could not resolve host: -F
The command I'm using is:
curl https://upload.box.com/api/2.0/files/content \ -H "Authorization: Bearer XXXXX" -X POST \ -F attributes='{"name":"test.jpg", "parent":{"id":"11446498"}}' \ -F file='@/Users/vprabhu/projects/test.jpg'
Adding -H 'Content-Length: 0' or -d 'Content-Length: 0' doesn't help either.
Any help would be appreciated!
-
It looks like your curl command might have gotten malformed; usually the backslahes are used to do a multiline command but yours appears to be all on one line. The curl error output seems to indicate that it didn't parse your command correctly:
curl: (6) Could not resolve host: -H
I tried running the same sort of command as yours without the backslashes and it worked perfectly; could you try running this and see if it works for you?
curl https://upload.box.com/api/2.0/files/content -H "Authorization: Bearer XXXXX" -X POST -F attributes='{"name":"test.jpg", "parent":{"id":"11446498"}}' -F file='@/Users/vprabhu/projects/test.jpg'
Please sign in to leave a comment.
Comments
1 comment