コード例 #1
0
 def post(self):
     upload_files = self.get_uploads("file")  # 'file' is file upload field in the form
     blob_info = upload_files[0]
     blobfile = BlobFile()
     blobfile.blobkey = blob_info.key()
     blobfile.name = blob_info.filename
     blobfile.user = users.get_current_user()
     blobfile.put()
     self.redirect("/")
コード例 #2
0
 def post(self):
     upload_files = self.get_uploads("file")  # 'file' is file upload field in the form
     blob_info = upload_files[0]
     blobfile = BlobFile()
     blobfile.blobkey = blob_info.key()
     blobfile.name = blob_info.filename
     blobfile.user = users.get_current_user()
     blobfile.put()
     context = {"image": False, "blob_url": "http://org-images.appspot.com/i/blob?id=%s" % blobfile.key}
     path = os.path.join(os.path.dirname(__file__), "templates", "show_links.html")
     # render the template with the provided context
     self.response.out.write(template.render(path, context))