title: How to upload image file via HTTP Google Cloud Function?
body: <p>I have read tutorials on how to upload the image to a bucket and do post processing via background function. But my requirement is to upload the image, do post processing and return the result immediately via HTTP function. Please let me know if this is the correct way to do or not as I didn't get much material online on this. Here is how I went about it:</p>
  
  <p>HTTP Cloud function:</p>
  
  <pre><code>exports.uploadImage = function (req, res){
   var file = req.body.file;
   uploadSomewhere(file)(); &lt; post-processing code which is working fine &gt;
  </code></pre>
  
  <p>UI form:</p>
  
  <pre><code>&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"&gt;&lt;/script&gt; 
  &lt;script src="http://malsup.github.com/jquery.form.js"&gt;&lt;/script&gt;
  &lt;form id="myForm" action="&lt;cloud_function_url&gt;/uploadImage" method="post"&gt; 
    &lt;label for="file"&gt;Choose file to upload&lt;/label&gt;
    &lt;input type="file" id="file" name="file" multiple&gt;
    &lt;input type="submit" value="Submit" /&gt; 
  &lt;/form&gt;
  
  &lt;script&gt; 
   $(document).ready(function() { 
    $('#myForm').ajaxForm(function() { 
   }); 
  }); 
  &lt;/script&gt;
  </code></pre>
  
  <p>The problem is, after I deployed the function, when I upload the image from the folder where function is present, image gets uploaded. But if I upload the image from any other location, it returns me error:</p>
  
  <p>Error: Error in uploading image file .... - Error: ENOENT: no such file or directory, open '....'</p>
  
  <p>Please let me know what am I doing wrong or if you need more information.</p>