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?

link|improve this question

48% accept rate
feedback

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
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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