Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can google app engine report progress back on file upload
    text
    copied!<p>I have been trying to use an ajax-style file upload component (like the dojox file upload component) with google app engine, and have a progress bar. </p> <p>The javascript side of things is fine, but i am wondering how to organise things on the server side? </p> <p>Is is possible to access the data as it is being uploaded within google app engine, something with BaseHTTPServer perhaps? I could then poll this from the client. </p> <p>Even if it wasn't possible to do the progress, at least it would be great to be able to terminate a large file and let the user know it was to big without making the user upload 1MB (the google app engine limit) and then find out it was to big. </p> <p>There are some similar questions: <a href="https://stackoverflow.com/questions/1298565/file-upload-progress">Similar stack overflow question 1</a>, <a href="https://stackoverflow.com/questions/1478434/how-is-the-file-uploading-progress-reported">Similar stack overflow question 2</a>.</p> <p>The following google app engine python code is just the basic post handler for a simple file upload (which works fine) but im looking for something that operates at a bit of a lower level. By the time the post handler gets it, the file has all been uploaded. </p> <p>On a LAMP stack you can poll a server side script that watches a temporary file size grow. When the file is moved from the temporary folder you know its completed. By using this method you can see the progress of multiple files without the use of flash, I'm not sure how to do the same thing with google app engine. </p> <pre><code>class fileupload(webapp.RequestHandler): """ """ def post(self): if "image" in self.request.arguments(): content = "&lt;html&gt;&lt;body&gt;Error&lt;/body&gt;&lt;/html&gt;" form = self.request.params['image'] logging.info(form) try: filename = form.filename siz = len(form.value) ###--- Show data logging.info("Filename: %s" % form.filename) logging.info("Size: %s" % siz) content = "&lt;html&gt;&lt;body&gt;File has been uploaded Name: %s Size: %s&lt;/body&gt;&lt;/html&gt;" % (filename, siz) logging.info("DONE") except: logging.info("Error: bad form or something like that") logging.info("writing out response") self.response.out.write(content) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload