title: cURL POST --data-binary vs --form
body: <p>I have a simple question regarding to the usage of cURL.  Didn't find much during my Google search or Man page to get a clear answer.</p>
  
  <p>In <a href="https://superuser.com/questions/361504/how-to-send-post-with-body-data-headers-andhttp-params-over-the-curl-command">here</a> talks about using either <code>--data</code> vs <code>--form</code> on sending file/attachment. I'm curious to know what are the main difference and under what scenarios you would pick <code>--data-binary</code> VS <code>--form</code> ?</p>
  
  <p>The POST "body" can be sent via either <code>--data (for application/x-www-form-urlencoded)</code> or <code>--form (for multipart/form-data)</code>:</p>
  
  <pre><code>-F "foo=bar"                  # 'foo' value is 'bar'
  -F "foo=&lt;foovalue.txt"        # the specified file is sent as plain text input
  -F "foo=@foovalue.txt"        # the specified file is sent as an attachment
  
  -d "foo=bar"
  -d "foo=&lt;foovalue.txt"
  -d "foo=@foovalue.txt"
  -d "@entirebody.txt"          # the specified file is used as the POST body
  
  --data-binary "@binarybody.jpg"
  </code></pre>