CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
An upload script that I downloaded



Jan 27, 2001, 7:29 PM

Post #1 of 1 (621 views)
An upload script that I downloaded Can't Post

What do I need to add in the following block to make it only accept file types of ".gif" or ".jpg"? Here's the block that checks that a file is valid or not:

my ($file, $okfile) = "";
$file = shift;

($file =~ m,^([A-Za-z0-9\-_.]*)$,) ?
($okfile = $1) :
(return ($file, "Illegal Characters in Filename. Please use letters, numbers, -, _ and . only."));

($file =~ m,\.\.,) and return ($file, "No double .. allowed in file names.");
($file =~ m,^\.,) and return ($file, "no leading '.' in file names.");
(length($file) > 20) and return ($file, "File name is too long. Please keep it to under 20 characters.");

return ($okfile, "");


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives