GAE works differently. You can't store files on the filesystem, so uploads 
have to be stored in blob fields in the datastore. For 'upload' fields on 
GAE, web2py automatically creates an associated blob field and stores the 
file there. In this case, it would create a blob field called "file_blob". 
To get the file, I think you could do:

filename, file = db.seed_file.file.retrieve(db(query).select().first().file)

In that case, "file" will be a cStringIO object. See 
http://web2py.com/books/default/chapter/29/6#Manual-uploads.

I don't use GAE, so perhaps there is an easier way.

Anthony

On Thursday, June 14, 2012 6:08:44 PM UTC-4, Umpei Kurokawa wrote:
>
> hmm maybe I'm missing a crucial detail. There doesn't appear to be an 
> "uploads" folder. I am currently using Google App Engine Launcher on my 
> windows computer with nosql to test it out though so I guess the files are 
> stored somewhere else?
>
> On Thursday, June 14, 2012 5:58:43 PM UTC-4, Anthony wrote:
>>
>> The field only stores the filename, not the full path, so you need to 
>> build the path:
>>
>> import os
>> file = open(os.path.join(request.folder, 'uploads', db.seed_file[id].file
>> ), 'wb')
>>
>> Anthony
>>
>> On Thursday, June 14, 2012 5:44:50 PM UTC-4, Umpei Kurokawa wrote:
>>>
>>> So I have a table in the database like this.
>>>
>>> db.define_table('seed_file',
>>>    Field('title','string'),
>>>    Field('file','upload'), 
>>>    format='%(title)s')
>>>
>>> And I want to open the uploaded files from this table from the 
>>> controller for further manipulation. Using open() function on file, I get 
>>> an error saying that it cannot find the file. 
>>> How is this done exactly? 
>>>
>>

Reply via email to