Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to make a request for uploading a file to facebook using graph api in curl

I am making this request but getting Error:

curl https://graph.facebook.com/<id>/photos  -F "source=@me.jpg"  -d "message=Me"  -v 

ERR:

Only One Http Request can be Selected

share|improve this question
up vote 6 down vote accepted

You can't use -F and -d together, since they use different content types, and you need multipart/form-data. So try with:

https://graph.facebook.com/<id>/photos -F "source=@me.jpg" -F "message=Me" -v

From man curl:

-F/--form

(HTTP) This lets curl emulate a filled-in form in which a user has pressed the submit button. This causes curl to POST data using the Content-Type multipart/form-data according to RFC2388. This enables uploading of binary files etc. To force the 'content' part to be a file, prefix the file name with an @ sign. To just get the content part from a file, prefix the file name with the symbol <. The difference between @ and < is then that @ makes a file get attached in the post as a file upload, while the < makes a text field and just get the contents for that text field from a file.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .