
razman
Novice
Jun 23, 2009, 4:42 PM
Post #1 of 3
(968 views)
|
|
Image Upload $ext
|
Can't Post
|
|
KevinR, in your image upload script, you place comments that talk to testing for file extensions. In another of your posts, you provide sample coding for testing for file extensions. When I put the pieces together and run the script, it uploads a .jpg image perfectly. If I try to upload a .gif, I get an Internal Server Error. If I remove the exit(0); coding, I then get "The XML page cannot be displayed ." I've been reading my Perl manula and working this script for hours. It is indeed time to ask you. Here's the portion of the image upload script that applies. my $file = $query->param("photo") or error('No file selected for upload.') ; $file =~ tr/\\/\//; # file extension testing addition next my @ext_list = qw(jpeg jpg); my ($filename,undef,$ext) = fileparse($file,@ext_list); unless ($ext) { print "Invalid file extension"; exit(0);} # get the filename and the file extension # this could be used to filter out unwanted filetypes # see the File::Basename documentation for details my ($filename,undef,$ext) = fileparse($file,qr{\..*});
|