in reply to Changing file names as they are uploaded
You do need to specify valid suffixes, but as you are only interested in images, it shouldn't be too much of a problem.my $ext = ""; if ($imagename =~ s/(\.jpe?g|\.gif|\.png)\z//i) { # updated $ext = $1; } $imagename =~ s/\W/_/g; # updated $imagename = $imagename.$ext; # updated
Update: Fixed some bugs pointed out by blakem. That'll teach me to test my code :-)
-- Joost downtime n. The period during which a system is error-free and immune from user input.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re2: Changing file names as they are uploaded
by blakem (Monsignor) on Sep 19, 2002 at 12:32 UTC |