my %file_ok = qw{
.gif 1
.jpg 1
.htm 1
.html 1
.txt 1
.doc 1
.pdf 1
};
and then....
($base,$path,$type) = fileparse($file,'\..*');
and finally...
$type =~ tr/A-Z/a-z/;
if (!$file_ok{$type}) {
print "The type of file you tried to upload ($type) is not sup
+ported.";
return;
}
how's that?
UPDATE: Added the line to make the extension lowercase as some losers in my industry love CAP LOCK.
_____________________________________________________ mojobozo
word (wûrd)
interj. Slang. Used to express approval or an affirmative response to something. Sometimes used with up. Source |