1

I have a problem deploying my application written in web2py on Google App Engine. Everything works well on localhost, but on GAE I cannot access the content of an uploaded file.

When I check the request.vars.my_upload_field var on localhost, I get: FieldStorage('upload_field', 'my_file.txt', 'File content')

But on GAE I only have: FieldStorage('upload_field', 'my_file.txt')

No file content... I did not do anything special (I believe...)

Why do I have such behaviour and how to fix it?

PS: I am using a SQLForm(db.my_table) that has an 'upload' field.

Thomas
  • 1,053
  • 2
  • 11
  • 20

2 Answers2

1

see detailed instructions for web2py and GAE blobstore upload here: http://web2pyslices.com/main/slices/take_slice/63

cfh
  • 26
  • 1
0

I haven't personally used web2py with GAE, but the official documentation

mentions something about difficulties in uploading files to the app-engine filesystem using web2py. So probably you could instead use GAE's own file-upload abilities like shown in this SO thread

Hope this helps a bit.

Community
  • 1
  • 1
JWL
  • 13,591
  • 7
  • 57
  • 63
  • Thank you for your answer. Unfortunately, if I want to use google.appengine.ext.webapp, I cannot use web2py framework... isn't it? For files smaller than 10MB (and mines are smaller than 10KB) it is supposed to work correctly... – Thomas Apr 16 '11 at 14:40
  • I tried adding at the top of my default.py: `if request.env.web2py_runtime_gae: from google.appengine.ext import webapp class GAEHandler(webapp.RequestHandler): def value(self, v): return self.request.get(v)` And then to call: `myApp = GAEHandler() content = myApp.value('my_upload_field')` But unfortunately it doesn't work... – Thomas Apr 16 '11 at 14:49