开发者

Upload a file with web2py on Google App Engine

开发者 https://www.devze.com 2023-02-26 20:51 出处:网络
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.

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('up开发者_高级运维load_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.


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消