0

I have searched and not found anything that answers the issue I'm experiencing. If I have missed this, my apologies.

Using curl, I have been trying to upload a small image file to an existing Box folder, but with no success. It does not return an error message that I can debug with. The folder_id I use is valid and I can list it's contents using relevant API call.

Below is the verbose results of the POST request. I would appreciate it if someone could shed light on where I'm going wrong

curl -k -v https://www.box.com/api/2.0/files/content/ -H "Authorization: BoxAuth api_key=API_KEY&auth_token=AUTH_TOKEN" -F filename="c:\alarms.gif" -F folder_id=FOLDER_ID

* About to connect() to www.box.com port 443 (#0)
*   Trying 74.112.184.70...
* connected
* Connected to www.box.com (74.112.184.70) port 443 (#0)
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using RC4-SHA
* Server certificate:
*        subject: serialNumber=ts5jamwzcjWP0oTyh2m74yh0zsB2zyOR; C=US; ST=California; L=Palo    Alto; O=Box.net, Inc.; CN=*.box.com
*        start date: 2011-09
*        expire date: 2013-09
*        subjectAltName: www.box.com matched
*        issuer: C=US; O
*        SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
> POST /api/2.0/files/content/ HTTP/1.1
> User-Agent: curl/7.28.0
> Host: www.box.com
> Accept: */*
> Authorization: BoxAuth api_key=API_KEY&auth_token=AUTH_TOKEN
> Content-Length: 263
> Expect: 100-continue
> Content-Type: multipart/form-data; boundary=----------------------------704f2d9b4096
>
* Done waiting for 100-continue
< HTTP/1.1 100 Continue
< HTTP/1.1 200 OK
< Server: nginx
< Date: Tue, 20 Nov 2012 08:14:13 GMT
< Content-Type: application/json
< Connection: keep-alive
< Cache-control: private
< Content-Length: 30
<
{"total_count":0,"entries":[]}* Connection #0 to host www.box.com left intact
* Closing connection #0
* SSLv3, TLS alert, Client hello (1):

The source file c:\alarms.gif is a valid file and exists. This is running from a windows host.

Any assistance or guidance will be appreciated

Tks

1 Answer 1

1

When uploading a local file using cURL, you need to prepend an @ symbol to the file path; this tells cURL to upload the file at that path, as opposed to just reading the string.In your case you want:

curl -k -v https://www.box.com/api/2.0/files/content/ -H "Authorization: BoxAuth api_key=API_KEY&auth_token=AUTH_TOKEN" -F filename=@"c:\alarms.gif" -F folder_id=FOLDER_ID
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you that worked perfectly. Somehow missed that in the docs !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.