Hi again. Perl newbie struggling to learn more Wisdom... Urrg. I'm probably missing something very basic, that I can't see. . . Here's what's happening:
I'm using a form that allows a user to browse to a file on their local system and upload it to our webserver. When I tested it on my local server it works fine.
However, when I test it on our actual web server, the Open function that reads the file (just prior to uploading it) seems to be looking for the file on the server, instead of on the local system, because it always dies saying it can't find the file.
I need it to read the specified user's local file as specified in the form's <input type="file"> tag. It dies in this line:
What am I missing? Here's my upload code snippet:open (IN,$fullpath) || dienice("Couldn't open file ** $fullpath ** f +or reading: $!");
$uploadpath = "newsletters/"; # Fullpath comes from file specified in the form $file = $fullpath; $file=~s/^.*(\\|\/)//; # STRIP PATHWAY OFF! # binmode $fullfile; $file = lc($file); #print "<p>Testing...file is: $file"; $buffer = ''; #print "<p>Testing...uploadpath is: $uploadpath"; #print "<p>Testing...Filehandle is: $uploadpath" . "$file"; # Open the file for reading open (IN,$fullpath) || dienice("Couldn't open file ** $fullpath ** f +or reading: $!"); # Open the directory for writing to open (SAVEFILE, ">$uploadpath"."$file") || dienice("Can't open fileh +andle: $uploadpath" . "$file $!\n"); binmode SAVEFILE; $i=0; while ($bytes = read(IN, $buffer, 1024)) { $bytesread += $bytes; print SAVEFILE $buffer; } close(SAVEFILE) || dienice ("Can't close filehandle: $uploadpath/$fi +le $!\n"); close (IN);
In reply to Open(IN,$fullpath) can't find local file by JaredHess
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |