1 curl snippet
Snippets are tiny notes I've collected for easy reference.
Uploading a file with curl
To submit the file at foo
to a web service as multi-part form data using curl
:
curl -X POST -F "file=@\"foo\"" 'https://127.0.0.1/example'
The file
part is the name of the corresponding form field.
Note that you can submit multiple files:
curl -X POST -F "f1=@\"foo\"&f2=@\"bar\"" 'https://127.0.0.1/example'
Or add additional body or query string parameters:
curl -X POST -F "f1=@\"foo\"&x=y" 'https://127.0.0.1/example?a=b'
Published 31 Dec 2015
Snippets are tiny notes I've collected for easy reference.