Send File Contents with Curl


Testing out new API endpoints, and want to use curl to do it, use the --data-binary and @filename syntax.

This sends the file IN the body.

# use the --data-binary to leave newlines intact, saw with images
curl --data-binary "@/path/to/filename"
# If you really need newlines stripped (eh?), use --data
curl --data "@/path/to/file"

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.