Will this work on AppEngine ? Since there is no filesystem

The code for manual uploads is :

stream = open(filename,'rb')

Will this not give error since it will not be able to find the file ? 

On Monday, June 18, 2012 6:52:02 PM UTC+5:30, Anthony wrote:
>
> and the my show_image function is :
>>
>> def show_image():
>>     return response.download(request,dal_db)
>>
>
> That's the problem -- response.download() calls dal.Field.retrieve(), 
> which assumes the filename is encoded via base64.b16encode (i.e., it 
> assumes the file was stored using dal.Field.store(), which encodes the 
> filename). Instead of manually creating the filename, you could use this 
> procedure: http://web2py.com/books/default/chapter/29/6#Manual-uploads. 
> Just make the filename exactly what you want the downloaded filename to be 
> (including the extension), and do the insert into the upload field -- it 
> should automatically create the encoded name, store the name in the upload 
> field, and store the image in the blob field. In this case, the image 
> should be a file stream, and I think fetch will return a string, so you 
> might need to do:
>
> import cStringIO
> profile_image = cStringIO.StringIO(result.content)
>
> Anthony
>

Reply via email to