wvbroker — 2013-12-23T03:16:32-05:00 — #1
I was looking for an easy way to upload photo's on to a website. I ran across an article UPLOADING FILES USING CGI AND PERL on site point.
I copied and pasted all the iformation to my text editor and changed the paths to what they needed to be and created the directories like the article stated however when I run the script I get Software error:
No such file or directory at /home/users/web/b2096/ipg.itsonlykinkythefirst/cgi-bin/fileuploadscript.cgi line 39.
I am not sure what file or folder name it is looking for can someone help me out on this? Here is the script that I can access on my server.
use CGI::Carp qw ( fatalsToBrowser );
$CGI::POST_MAX = 1024 * 5000;
my $safe_filename_characters = "a-zA-Z0-9_.-";
my $upload_dir = "/home/www.itsonlykinkythefirsttime.com/htdocs/upload";
my $query = new CGI;
my $filename = $query->param("photo");
my $email_address = $query->param("email_address");
if ( !$filename )
print $query->header ( );
print "There was a problem uploading your photo (try a smaller file).";
my ( $name, $path, $extension ) = fileparse ( $filename, '..*' );
$filename = $name . $extension;
$filename =~ tr/ /_/;
$filename =~ s/[^$safe_filename_characters]//g;
if ( $filename =~ /^([$safe_filename_characters]+)$/ )
$filename = $1;
die "Filename contains invalid characters";
my $upload_filehandle = $query->upload("photo");
open ( UPLOADFILE, ">$upload_dir/$filename" ) or die "$!";
while ( <$upload_filehandle> )
I am sure it is something simple I just can not figure it out. Thanks for your help.
john_betong — 2013-12-23T03:57:14-05:00 — #2
The error message states that the directory does not exist.
exprolab — 2014-01-27T07:46:17-05:00 — #3
what is this? I am a learner of php. Can you describe me what is the code for?
mittineague — 2014-01-27T11:27:06-05:00 — #4
Current Working Directory
You're interested in learning Perl as well?