python - Upload Video to GAE Blobstore and Get Input While Uploading -


i am using google app engine in python , want users able upload video, functioning following basic example want able user add additional information video, title , category , summary while uploading. there way can make upload asynchronous user doesn't have wait whole time video uploading?

i know create_upload_url_async() method doesn't trying.

right have following uploads , serves want make intermediate step user can add info preferably on same screen uploadhandler while uploading.

class videohandler(bloghandler):     def get(self):               user = self.get_user()         upload_url = blobstore.create_upload_url('/uploadingvideo')         self.render('videohandler.html', user=user, upload_url=upload_url)  class uploadhandler(blobstore_handlers.blobstoreuploadhandler):   def post(self):     upload_files = self.get_uploads('file')  # 'file' file upload field in form     blob_info = upload_files[0]     self.redirect('/serve/%s' % blob_info.key())  class servehandler(blobstore_handlers.blobstoredownloadhandler):   def get(self, blob_key):         blob_key = str(urllib.unquote(blob_key))         if not blobstore.get(blob_key):             self.error(404)         else:             self.send_blob(blobstore.blobinfo.get(blob_key)) 

i'd glad provide more information if need it.

this has been troubling me alot clifgray. solution build form around blob form.

here's google's example on how submit data blob store.

class uploadhandler(blobstore_handlers.blobstoreuploadhandler):   def post(self):     upload_files = self.get_uploads('file')  # 'file' file upload field in form     blob_info = upload_files[0]     self.redirect('/serve/%s' % blob_info.key()) 

just remove self redirect bit @ bottom of code , add code handle form.

class uploadhandler(blobstore_handlers.blobstoreuploadhandler):   def post(self):     upload_files = self.get_uploads('file')  # 'file' file upload field in form     blob_info = upload_files[0]  greeting = greeting()  if users.get_current_user(): greeting.author = users.get_current_user() greeting.video = str(blob_info.key()) greeting.content = self.request.get('content')   greeting.put() 

your form in django template should this:

form action="{{ upload_url }}" enctype="multipart/form-data"  method="post">  textarea name="content" placeholder="write video.."  tabindex="1" rows="2" cols="40"></textarea>  input name="file" type="file" >  input name="submit" type="submit" value="submit"  />  /form> 

there have it. hope helps


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -