title: Form image data, how to handle image?
body: <p>So I send a <code>Form</code> to my Flask App and wish to receive the Form image data input and pass it to another function.</p>
  <p><strong>Example of form:</strong></p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>    &lt;form action="https://example.com/api/accept_form" method="POST" enctype="multipart/form-data"&gt;
      &lt;label for="fileupload"&gt;&lt;input type="file" name="fileupload" value="fileupload" id="fileupload"  accept="image/*"&gt;
       Select a file to upload&lt;/label&gt;
      &lt;br&gt;&lt;button id="submit"&gt;Post to Instagram&lt;/button&gt;
      &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>On the flask app:</p>
  <pre><code>def image_function(image):
       #DO SOMETHING WITH THE IMAGE
  
  @main.route(&quot;/api/accept_form&quot;, methods=[&quot;POST&quot;])
  def manipulate_image():
      image = request.form[&quot;fileupload&quot;]
      image_function(image)
  </code></pre>
  <p>I can see how the image data looks using the print command:</p>
  <pre><code>request.files[&quot;fileupload&quot;] = &lt;FileStorage: '666650673.jpg' ('image/jpeg')&gt;
  request.files[&quot;fileupload&quot;].read() = b'\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00H\x00H\x00\x00\xff\xe1\x00 and so on ...'
  </code></pre>
  <p>How do I pass the image to another function in the Flask App as if it was the original <code>.jpg</code> submitted, called from the Flask Apps current directory using <code>&quot;./666650673.jpg&quot;</code>?</p>
  <p>References:</p>
  <p><a href="https://linuxhint.com/python-string-decode-method/" rel="nofollow noreferrer">https://linuxhint.com/python-string-decode-method/</a></p>
  <p><a href="https://stackoverflow.com/a/2324133/14843373">https://stackoverflow.com/a/2324133/14843373</a></p>
  <p><a href="https://github.com/williballenthin/python-evtx/issues/43" rel="nofollow noreferrer">https://github.com/williballenthin/python-evtx/issues/43</a></p>