using CURL to transmit binary data over POST parameter

10,940

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.

Share:
10,940

Related videos on Youtube

Martin Čapka
Author by

Martin Čapka

Updated on September 18, 2022

Comments

  • Martin Čapka
    Martin Čapka over 1 year

    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.

  • Martin Čapka
    Martin Čapka over 9 years
    How do i get the response of the post request? Thanks a lot :).