Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to use curl to http post a file to a url like:

curl -d myfile.xml http://www.example.dom/post/file/here

Can I set the parameter I want the file to be posted with? Like if it was a querystring I would do: ?file=filedatahere

How do you do that with a post?

share|improve this question
add comment

1 Answer

Yes you can specify parameters via querystring to a resource you are posting to. Also you should use '@' before a filename if the data is being read from a file. So using your example I believe this should look like:

curl -d @myfile.xml "http://www.example.dom/post/file/here?foo=bar&this=that"
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.