Reputation: 8367
I have a form with a file input and a few text fields and i'd like to Upload the file to the blobstore and then handle the rest of the input. I have found documentation from google but I'm still fuzzy on the details. If I have the right idea you first generate a submit url for the form like so:
blobstore.create_upload_url('/handlerURL')
where handlerURL is the url of the request handler that process the regular form data such as text fields etc
Next you define a BlobstoreUploadHandler
, this is where i get fuzzy... From the documentation I understand that the BlobstoreUploadHandler
deals with uploading the file then passes a rewritten request to \handlerURL
. My confusion arrises when in the docs here:
https://developers.google.com/appengine/docs/python/tools/webapp/blobstorehandlers
an instance of a data model object is created inside the BlobstoreUploadHandler
but if i were to want to do additional processing and use data from other fields in the request handler at handlerURL
then the BlobstoreUploadHandler
would just be empty, is this correct or am i misunderstanding the process?
Upvotes: 1
Views: 266
Reputation: 819
This is indeed a little tricky as two handlers are involved here.
Upvotes: 0
Reputation: 7054
BlobstoreUploadHandler just sanitizes the file upload part of the multipart message, you can still access the rest of the fields of your form using webapp the standard way (e.g. self.request.get('some_field_in_the _form')).
Upvotes: 2