python - Reading and writing files from html in Google App Engine -


i working gae , python, know python, don't know html, seems need right now. want take in text file write in return download. using other people's examples, far have is:

class mainpage(webapp.requesthandler):      #http://bukhantsov.org/2011/12/python-google-app-engine-calculator/     def get(self):         self.response.out.write("""<html>             <body>             <form action='/' method='get' autocomplete='off'>              <input type='file' name='file'/><br/>              </form>             </body>             </html>""") 

i imagine there need put in file line can access user feeds it, don't know or how access python code. should here?


if understand question correctly, trying grab text data being sent user via call defined form action html line.

concisely, looking call:

file = self.request.get('file') 

this may useful:

filename = self.request.get['file'].filename 

these can used in same location , in conjunction "self.response.out".

more information can found here: https://developers.google.com/appengine/docs/python/tools/webapp/requestclass#request_get

alternatively, blobstore apis may easier. https://developers.google.com/appengine/docs/python/blobstore/overview

possibly related: upload files in google app engine, get original filename google app engine

hope helps!
jess


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -