Re: [web2py] Re: delete stored image

2013-07-23 Thread Nicolas Rodriguez
Thanks :P awesome thats really simple hahaha :D


On Tue, Jul 23, 2013 at 5:06 PM, Niphlod  wrote:

> use Field('image', 'upload', autodelete=True)
>
>
> On Tuesday, July 23, 2013 10:18:24 PM UTC+2, nicor...@gmail.com wrote:
>>
>> i am making a product app in web2py everything is working really well
>> exept one thing.
>>
>> i upload the images like this:
>>
>> the_image = db.product_images.image.store(**request.vars.image.file,
>> request.vars.image.filename)
>> img_id = db.product_images.insert(**product_id=p_id ,
>> image=the_image , main_image=True)
>>
>> that work awesome, it stores the image in the uploads folder.
>> now the problem is when i try to delete a image it only deletes the
>> database record, and not the image itself stored in the uploads folder
>>
>> this is how i delete my current image:
>>
>> db(db.product_images.id == img_id).delete()
>>
>> i want to know how can i delete the image and not only the record so i
>> dont store that amazing ammount of unused images in the server.
>>
>> Txn for your help!!!
>>
>  --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/ULmgbt5L-1c/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: delete stored image

2013-07-23 Thread Niphlod
use Field('image', 'upload', autodelete=True)

On Tuesday, July 23, 2013 10:18:24 PM UTC+2, nicor...@gmail.com wrote:
>
> i am making a product app in web2py everything is working really well 
> exept one thing.
>
> i upload the images like this:
>
> the_image = db.product_images.image.store(request.vars.image.file, 
> request.vars.image.filename)
> img_id = db.product_images.insert(product_id=p_id , 
> image=the_image , main_image=True)
>
> that work awesome, it stores the image in the uploads folder.
> now the problem is when i try to delete a image it only deletes the 
> database record, and not the image itself stored in the uploads folder
>
> this is how i delete my current image:
>
> db(db.product_images.id == img_id).delete()
>
> i want to know how can i delete the image and not only the record so i 
> dont store that amazing ammount of unused images in the server.
>
> Txn for your help!!!
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.