andrew has asked for the wisdom of the Perl Monks concerning the following question:
When it comes to the point of checking what kind of extention it has, even if it is a gif I get a error "Your image needs to be in GIF or JPEG format." Anyone know why??@alltypes = qw(.gif .jpg .jpeg .jpe .jfif); if(param('im1') || param('im2') || param('im3') || param('im4') || par +am('im5')) { for ($i=1; $i<=5; $i++) { if (param("im$i")) { $file = param("im$i"); $filename = param("im$i"); $filename =~ s/.*[\/\\]//; $ext = param("im$i"); $ext =~ s/^[^.]*(\.[\w]+$)/$1/; foreach $line (@alltypes) { if(($ext !~ /$line/i)) { error("Your image needs to be in GIF or JPEG format."); } } } } } else { error("You need to upload at least one image!"); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Checking File Types
by Chmrr (Vicar) on Oct 10, 2002 at 01:34 UTC | |
Re: Checking File Types
by rob_au (Abbot) on Oct 10, 2002 at 03:06 UTC | |
Re: Checking File Types
by Revelation (Deacon) on Oct 10, 2002 at 02:29 UTC | |
Re: Checking File Types
by l2kashe (Deacon) on Oct 10, 2002 at 02:54 UTC | |
Re: Checking File Types
by andrew (Acolyte) on Oct 10, 2002 at 02:48 UTC | |
by Chmrr (Vicar) on Oct 10, 2002 at 04:12 UTC | |
Re: Checking File Types
by Mr. Muskrat (Canon) on Oct 10, 2002 at 14:02 UTC | |
A reply falls below the community's threshold of quality. You may see it by logging in. |