Hi Everyone,
Here I am trying to upload a file asynchronously to the blobstore. Below is
what I've done so far:
*html file*
<form id="my_form" enctype="multipart/form-data" method="POST"
action="/partner">
<input type="file" id="my_file" name="my_file"/>
</form>
*js file*
my.Project.prototype.onFileUpload = function(e) {
var uploadForm = /** @type {HTMLFormElement} */ (
goog.dom.getElement('my_form'));
var iframeIo = new goog.net.IframeIo();
goog.events.listen(iframeIo, goog.net.EventType.COMPLETE, function() {
alert('request complete'); });
iframeIo.sendFromForm(uploadForm);
*python code*
class MyHandler(blobstore_handlers.BlobstoreUploadHandler):
def post(self):
logging.info(self.request) // I can see my file in this line's output
upload_files = self.get_uploads('my_file')
logging.info(upload_files) //upload_files come out to be an empty array
blob_info = upload_files[0]
self.redirect('/partner/serve/%s' % blob_info.key())
Any pointers on how to get the file to be uploaded from the request object.
The python code provided by google's tutorial on BlobStore can be found here
<https://developers.google.com/appengine/docs/python/blobstore/overview#Complete_Sample_App>.
Now I am stuck. I believe if I can get the file in python code I'll be able to
upload it.
Any pointers will be very helpful.
Thanks,
Mohit
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-appengine/-/B6rjqiK6ZD4J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.