If you wanted to get really fancy, you could install Imagemagick.  Use 
that to detect the file-type based on the data rather than the filename 
that the user supplies.  That would be more accurate but slower than 
Massimo's method.

-tim

mdipierro wrote:
> class IS_GIF:
>     def __init__(self,em): self.em=em
>     def __call__(self,value):
>         if value and value.filename[-4:].lower()!='.gif':
>             return (value,self.em)
>         return (value,None)
>
> db.table.field.requires=IS_GIF()
>
> On Mar 17, 7:45 pm, TheDude <[email protected]> wrote:
>   
>> How would I only allow gif, png or jpeg images to be uploaded?
>>     
> >
>   

-- 
Timothy Farrell <[email protected]>
Computer Guy
Statewide General Insurance Agency (www.swgen.com)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to