Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7992977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:43:23+00:00 2026-06-04T13:43:23+00:00

I am reading about the Blobstore in Google App Engine. The code below is

  • 0

I am reading about the Blobstore in Google App Engine. The code below is from the sample documentation. After the user selects a file to upload and clicks Submit, how do I get the key into a javascript variable? I can show it on a page, but I only want to keep it for later use. Obviously, I am new to Web programming.

#!/usr/bin/env python
#

import os
import urllib
from google.appengine.ext import blobstore
from google.appengine.ext import webapp
from google.appengine.ext.webapp import blobstore_handlers
from google.appengine.ext.webapp.util import run_wsgi_app

class MainHandler(webapp.RequestHandler):
  def get(self):
    upload_url = blobstore.create_upload_url('/upload')
    self.response.out.write('<html><body>')
    self.response.out.write('<form action="%s" method="POST" enctype="multipart/form-data">' % upload_url)
    self.response.out.write("""Upload File: <input type="file" name="file"><br> <input type="submit"
    name="submit" value="Submit"> </form></body></html>""")

class UploadHandler(blobstore_handlers.BlobstoreUploadHandler):
  def post(self):
    upload_files = self.get_uploads('file')  # 'file' is file upload     field in the form
    blob_info = upload_files[0]
    self.response.out.write('<html><body>')
    self.response.out.write(str(blob_info.key()))
    self.response.out.write('</body><html>')

def main():
  application = webapp.WSGIApplication(
    [('/', MainHandler),
     ('/upload', UploadHandler),
    ], debug=True)
  run_wsgi_app(application)

if __name__ == '__main__':
  main()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T13:43:24+00:00Added an answer on June 4, 2026 at 1:43 pm

    You could do something like this:

    self.response.out.write("""
    <html>
    <script>
    var blobKey = "%s";
    </script>
    <body>
    ...
    </body>
    </html>""" % (blob_info.key(),)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After reading about the differences between appSettings and applicationSettings in a web.config file, I'd
I have followed the sample code below to upload a zip file in the
After reading about how file based PHP sessions are not the greatest for performance,
Reading about the Dispose pattern , I see the documentation repeatedly refer to cleaning
After reading about the problem of passing empty std::string objects between DLLs and EXEs,
Reading about how Google solves the translation problem got me thinking. Would it be
After reading about CCR : http://www.infoq.com/news/2008/12/CCR I get the impression that it does pretty
After reading about the System.Diagnostics.Contracts.Contract static class that has been influenced by the awesomeness
After reading about salts password hashing Id like to implement a simple version for
After reading about Mapper XMLs I can't help to wonder how one might go

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.