No such file or folder

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.

#!/usr/bin/perl -wT

use strict;
use CGI;
use CGI::Carp qw ( fatalsToBrowser );
use File::Basename;

$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).";
exit;
}

my ( $name, $path, $extension ) = fileparse ( $filename, '..*' );
$filename = $name . $extension;
$filename =~ tr/ /_/;
$filename =~ s/[^$safe_filename_characters]//g;

if ( $filename =~ /^([$safe_filename_characters]+)$/ )
{
$filename = $1;
}
else
{
die "Filename contains invalid characters";
}

my $upload_filehandle = $query->upload("photo");

open ( UPLOADFILE, ">$upload_dir/$filename" ) or die "$!";
binmode UPLOADFILE;

while ( <$upload_filehandle> )
{
print UPLOADFILE;
}

close UPLOADFILE;

I am sure it is something simple I just can not figure it out. Thanks for your help.

The error message states that the directory does not exist.

Try this:



print getcwd();



http://perldoc.perl.org/Cwd.html#getcwd-and-friends

what is this? I am a learner of php. Can you describe me what is the code for?

Current Working Directory

You’re interested in learning Perl as well?