I am using cURL command line utility to send HTTP POST to a web service. I want to include a file's contents as the body entity of the POST. I have tried using -d </path/to/filename>
as well as other variants with type info like --data </path/to/filename> --data-urlencode </path/to/filename>
etc… the file is always attached. I need it as the body entity.
How to send file contents as body entity using cURL
curlpost
Related Topic
- Json – How to POST JSON data with cURL
- Getting only response header from HTTP POST using cURL
- Using cURL to upload POST data with files
- How to capture cURL output to a file
- How to measure request and response times at once using cURL
- AngularJs $http.post() does not send data
- Jsp – Difference between jsp expression tags <% and <%=
- Json – How to send JSON file as part of request body in CURL POST command
Best Answer
I believe you're looking for the
@filename
syntax, e.g.:strip new lines
keep new lines
curl will strip all newlines from the file. If you want to send the file with newlines intact, use
--data-binary
in place of --data