Re: Question: Limiting Filetypes Uploaded

[prev] [thread] [next] [Date index for 2005/03/02]

From: Dan Wilga
Subject: Re: Question: Limiting Filetypes Uploaded
Date: 22:04 on 02 Mar 2005
At 1:44 PM -0500 3/1/05, Jonathan Vanasco wrote:
>I'm in need of a 'good' method to limit files uploaded via mod_perl2 
>( to photos of gif/jpg/png 100k or less)

>	2 - i've noticed a type of "image/jpeg"  "image/gif" 
>"image/png" for uploaded file types.  can this be relied on to any 
>extent?

I wouldn't. You're relying on the browser to supply a proper MIMe 
type, which IMHO is not the best place to put the burden.

Personally, I use Image::Size::imgsize() (see CPAN) for this. It 
automagically figures out the image's type (and size) based upon the 
file header. It doesn't even rely upon the .jpg or .gif ending, which 
would also be a bad idea.

        -- 
        Dan Wilga                                         dwilga@xxxxxxxxx.xxx
Web Administrator                             http://www.mtholyoke.edu
Mount Holyoke College                                Tel: 413-538-3027
South Hadley, MA  01075            "Who left the cake out in the rain?"

(message missing)

Question: Limiting Filetypes Uploaded
Jonathan Vanasco 18:44 on 01 Mar 2005

Re: Question: Limiting Filetypes Uploaded
Dan Wilga 22:04 on 02 Mar 2005

Re: Question: Limiting Filetypes Uploaded
Jonathan Vanasco 23:08 on 02 Mar 2005

Re: Question: Limiting Filetypes Uploaded
Richard F. Rebel 00:21 on 03 Mar 2005

Re: Question: Limiting Filetypes Uploaded
jonathan vanasco 04:48 on 03 Mar 2005

Re: Question: Limiting Filetypes Uploaded
Richard F. Rebel 16:29 on 03 Mar 2005

Re: Question: Limiting Filetypes Uploaded
Dan Wilga 22:05 on 03 Mar 2005

Re: Question: Limiting Filetypes Uploaded
Jonathan Vanasco 18:55 on 03 Mar 2005

Re: Question: Limiting Filetypes Uploaded
Todd Finney 22:58 on 03 Mar 2005

Generated at 00:33 on 04 Mar 2005 by mariachi v0.52