title: Saving an Image from URL in Parse.com using CloudCode
body: <p>I have been struggling with saving a file I retrieve from an HTTP Request for a a few days now. Here is my code:</p>
  
  <pre><code>    Parse.Cloud.httpRequest({
      url: "https://ss1.4sqi.net/img/categories_v2/food/vietnamese_88.png",
      success: function(httpImgFile) 
      {
          console.log("httpImgFile: " + String(httpImgFile.buffer));
          var imgFile = new Parse.File("imgFile1.png", httpImgFile.buffer);                                               
          object.set("location", "newYork"); //object is a PFObject retrieved earlier
          object.set("icon1", imgFile);
          object.save(null, {
            success: function(gameScore) {
              response.success("saved object");
            },
            error: function(gameScore, error) {
              response.error("failed to save object");
            }
          });     
      },
      error: function(httpResponse) 
      {
          console.log("unsuccessful http request");
          response.error(responseString);
      }
  });
  </code></pre>
  
  <p>The error I get is:</p>
  
  <pre><code>Failed with: TypeError: Cannot call method 'then' of undefined
      at Object.b.File.save (Parse.js:2:14963)
      at null.&lt;anonymous&gt; (Parse.js:2:30041)
      at e (Parse.js:2:6339)
      at Parse.js:2:7092
      at g (Parse.js:2:6829)
      at c.extend.then (Parse.js:2:7077)
      at Parse.js:2:30016
      at Array.forEach (native)
      at Function.x.each.x.forEach (Parse.js:1:661)
      at Function.b.Object._deepSaveAsync (Parse.js:2:29993)
  </code></pre>
  
  <p>The weirdest part about all this is that the error only occurs when I include the line <code>object.set("icon1", imgFile)</code>
  I am able to to modify the location of <code>object</code> without problem. The error occurs solely when I try to save the <code>imgFile</code> to <code>icon1</code></p>
  
  <p>Any help would be greatly appreciated. Thanks!</p>