How can i use CURL to send binary data through a specific post parameter? E.g in:

curl 'http://www.example.com' -H 'hi:hi' --data 'utf8=%E2%9C%93&_method=put&file=binarydatahere&submit=confirm'

I want to send the binary data through the file parameter, I've heard of the --data-binary @myfile.bin method, but i fail to see how i can specify to which parameter the binary data goes through.

1 Answer 1


Put the name of the parameter in front of the @, like this:

--data-binary [email protected]

From the curl manpage:

name@filename This will make curl load data from the given file (including any newlines), URL-encode that data and pass it on in the POST. The name part gets an equal sign appended, resulting in name=urlencoded-file-content. Note that the name is expected to be URL-encoded already.

  • How do i get the response of the post request? Thanks a lot :).
    – gxg41818
    Dec 29, 2014 at 23:22

You must log in to answer this question.

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