Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I'm not posting the subroutines because I never manage to reach them. I get stopped with "Not seeing the filetype: ", but $ext seems to be empty by the time I get there. I tried messing around with the scope of $ext (removing "use strict;" and "my"), to no avail. And yes, yes: I realize that I'm running with this on a Windows machine. Any help would be most appreciated. Thank you, kind monks. Cheers, K.#!C:\Perl\bin\perl.exe -wT ## use strict; use warnings; use CGI; use CGI::Carp qw/fatalsToBrowser/; use File::Basename; $CGI::POST_MAX = 1024*5000; $CGI::DISABLE_UPLOADS = 0; my $query = CGI->new; my $safeCharacters = 'a-zA-Z0-9_.-'; my $uploadDirectory = 'C:/Apache/htdocs/notoriousteaze.com/Images/Temp +'; my $originalImage = $query->param("Image"); my ($filename, undef, $ext) = fileparse($originalImage, qr({\..*})); $filename .= $ext; $filename =~ tr/ /_/; $filename =~ s/[^$safeCharacters]//g; if ($filename =~ /^([$safeCharacters]+)$/) { $filename = $1; } else { error("That file name doesnt work for me. $filename"); } my $uploadFilename = $query->upload("Image"); open(UPLOADFILE, ">$uploadDirectory/$filename") or error('Could Not Up +load File.'); while ( <$uploadFilename> ) { print UPLOADFILE; } close UPLOADFILE; my %resizeFileType = ( ".jpeg" => \&resizeJpeg, ".jpg" => \&resizeJpeg, ".gif" => \&resizeGif, ".png" => \&resizePng, ); if(defined ($resizeFileType{$ext}) { $resizeFileType{$ext}->(); } else { error("Not seeing the filetype: $ext"); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: A Wayward Variable
by apl (Monsignor) on Mar 26, 2008 at 17:16 UTC | |
by kalchas (Acolyte) on Mar 26, 2008 at 18:53 UTC | |
|
Re: A Wayward Variable
by Pancho (Pilgrim) on Mar 26, 2008 at 17:12 UTC | |
by kalchas (Acolyte) on Mar 26, 2008 at 18:48 UTC | |
|
Re: A Wayward Variable
by Old_Gray_Bear (Bishop) on Mar 26, 2008 at 17:15 UTC | |
by kalchas (Acolyte) on Mar 26, 2008 at 18:51 UTC |