holmesal
holmesal

Reputation: 742

Blobstore POST redirecting to /undefined - Google App Engine

Really confused about this...

I take in a content ID on

app = webapp2.WSGIApplication([('/mobile/upload',MobileUploadHandler), ('/mobile/(.*)',ContentIDHandler)],debug=True)

If there is a post action attached to the content ID, I write out a form (via a jinja2 template):

template = jinja_environment.get_template('templates/mobileupload.html') template_values = {'upload_url':blobstore.create_upload_url('/mobile/upload')} self.response.out.write(template.render(template_values))

The blob upload URL is visible in the HTML. I don't know that it is correct, but it looks like a blob upload URL.

When the form POSTs, it is supposed to redirect to this handler:

`class MobileUploadHandler(blobstore_handlers.BlobstoreUploadHandler):

def post(self):`

However, it never gets there - it redirects instead to /mobile/undefined.

I'm not really sure what this means. Is there a problem with the argument I passed to create_upload_url?

Upvotes: 0

Views: 343

Answers (1)

Paul Collingwood
Paul Collingwood

Reputation: 9116

However, it never gets there - it redirects instead to /mobile/undefined.

Which is exactly what it's supposed to do.

The user creates a blob by submitting an HTML form that includes one or more file input fields. Your application calls create_upload_url() to get the destination (action) of this form, passing the function a URL path of a handler in your application. When the user submits the form, the user's browser uploads the specified files directly to the Blobstore. The Blobstore rewrites the user's request and stores the uploaded file data, replacing the uploaded file data with one or more corresponding blob keys, then passes the rewritten request to the handler at the URL path you provided to create_upload_url().

https://developers.google.com/appengine/docs/python/blobstore/overview

Upvotes: 0

Related Questions