I am probably doing something stupid here, but hope that someone can shed some light on this for me....
Trying to do a file upload and I want the local file name to be used as the remote name.
For example if the local name is test.txt, the remote name should be test.txt.
What I am getting, is the file I am uploading is a very simple file that contains a single line that states "This is a test file."
When the file is saved, it is saved as "This is a test file"
Can anyone point me in the right direction?
Thanks for reading,
Jim
Trying to do a file upload and I want the local file name to be used as the remote name.
For example if the local name is test.txt, the remote name should be test.txt.
What I am getting, is the file I am uploading is a very simple file that contains a single line that states "This is a test file."
When the file is saved, it is saved as "This is a test file"
Can anyone point me in the right direction?
Thanks for reading,
Jim
Code:
if ($input{'UPLOAD'}) {
$dir = '/home/users/web/b2578/pow.royridgeway/htdocs/Roy/';
$filename =~ s/.*[\/\\](.*)/$1/;
my $upload_filehandle = "$filename";
open UPLOADFILE, ">$dir/$filename, 0755";
binmode UPLOADFILE;
while ( <$upload_filehandle> )
{
print UPLOADFILE;
}
close UPLOADFILE;
}