title: Can we add binary raw data to a <form>?
body: <p>Is it possible to add binary raw data to a form, e.g. in this <code>data</code> field:</p>
  
  <pre><code>&lt;form action="/upload" method="post"&gt;
  &lt;input type="hidden" id="data" /&gt;
  &lt;input type="submit" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>?</p>
  
  <p>In my use case, I want to export an image from a <code>canvas</code> to JPEG with <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL" rel="nofollow noreferrer"><code>toDataURL</code></a>, then decode the base64 <strong>to binary data</strong>, add the binary data to the <code>&lt;form&gt;</code>, which will be ready for submitting.</p>
  
  <p>Why do I want to <strong>not</strong> just post the base64-encoded data? Because I would like to save 1/3 of uploading time for client / bandwidth for server, and it is well known base64 is bigger than binary data of a factor 1.333.</p>