title: How do I save web images to App Engine's blobstore?
body: <p>I've used <a href="https://stackoverflow.com/questions/4564619/how-to-use-google-app-engines-blobstore-to-save-web-images">this question</a> as a template to solve the same problem, but I'm running into issues when posting. I have these components: </p>
  
  <ol>
  <li>HTML <strong>form</strong> with a textbox for the image URL. This posts to...</li>
  <li>A <strong>handler</strong> that takes the posted URL, encodes it, and uses <code>urlfetch</code> to post it again to... </li>
  <li>A separate <strong>file upload handler</strong> that does the actual saving. </li>
  </ol>
  
  <p>Component #3 works fine by itself if I use a file input. But I don't quite understand how to get <code>urlfetch</code> what it needs from just the image URL. My process either times out or gets a 500 response from the final handler. </p>
  
  <pre><code># 1
  class URLMainHandler(RequestHandler):
      def get(self):
          return render_response('blob/upload_url.html', 
                                 upload_url=url_for('blobstore/upload/url'))
  # 2        
  class URLUploadHandler(RequestHandler):
      def post(self):
          import urllib
          # Get the posted image URL. 
          data = urllib.urlencode({'file': self.request.form.get('file')})
          # Post image to blobstore by calling POST on the file upload handler. 
          result = urlfetch.fetch(url=blobstore.create_upload_url(url_for('blobstore/upload')),
                                  payload=data, 
                                  method=urlfetch.POST)
  
          return self.redirect(url_for('blobstore/url'), result.status_code)
  
  # 3
  class UploadHandler(RequestHandler, BlobstoreUploadMixin):
      def post(self):
          # 'file' is the name of the file upload field in the form.
          upload_files = self.get_uploads('file')
          blob_info = upload_files[0]
          response = redirect_to('blobstore/serve', resource=blob_info.key())
          # Clear the response body.
          response.data = ''
          return response
  </code></pre>
  
  <p>Again, <a href="https://stackoverflow.com/questions/4564619/how-to-use-google-app-engines-blobstore-to-save-web-images">this is the process I'm following</a>. Thanks for your help!</p>