Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question

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.

share|improve this answer
    
How do i get the response of the post request? Thanks a lot :). –  gxg41818 Dec 29 '14 at 23:22

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.