yes

row.update(avatar=db.tablename.avatar.store(request.post_vars['upload_field'
],filename='yourname.ext'))

On Friday, 4 January 2013 00:36:31 UTC-6, Wonton wrote:
>
> Hello Massimo!
>
> I bypass the form.proccess because this is a web service used by an iOS 
> app. I do all frontend stuff in iOS and call this web service from the 
> device.
>
> And regarding to change the name of the file, is it possible?
>
> kind regards!
>
> El viernes, 4 de enero de 2013 04:11:16 UTC+1, Massimo Di Pierro escribió:
>>
>> You can do
>>
>> row.update(avatar=db.tablename.avatar.store(request.post_vars[
>> 'upload_field']))
>>
>> by why bypess form.process()? it does it for you.
>>
>> On Thursday, 3 January 2013 15:57:24 UTC-6, Wonton wrote:
>>>
>>> Hello!
>>>
>>> I'm trying to implement uploading user's avatar. I've tried to follow 
>>> the image blog example from the book and some of the posts related to this 
>>> issue in this forum and I'm still a bit confused and I don't know if I 
>>> could do certain things or how to do them.
>>>
>>> What I would like to achieve is this:
>>>
>>> -Upload the avatar and store it in the file system. The link to the file 
>>> will be stored in the database. As far as I know this is possible with 
>>> Field('avatar', 'upload'). 
>>> But, my first doubt: could I store the image file with a custom name, 
>>> for example <auth_user.username>.jpg? I see that the file has a strange 
>>> name when it's stored.
>>>
>>> -I would like the image to be public, anyone could see that image in any 
>>> browser through its link.
>>> But, my second doubt: the content of the avatar field in my database is 
>>> a File, and when I go to that link I see the content of the file in the URL 
>>> and don't see the image.
>>>
>>> Finally, my last doubt, in my web service I access the image data 
>>> through request.post_vars. If I print this data I get something like this:
>>> <Storage {'upload_field': FieldStorage('upload_field', 'myphoto_1.jpg', 
>>> '\xff\xd8\ 
>>> ... ... ...\x04\xd9')}>
>>> I guess I have to store the image in the database with this:
>>> row.update(avatar=request.post_vars['upload_field'])
>>> Am I right?
>>>
>>>
>>> Thank you very much!
>>>
>>>
>>>
>>>

-- 



Reply via email to