J
Jo Oberman
Hello,
I'm using CGI.pm to make some file uploads to the web-server.
It works great, but the problem is that I'm not able to delete
the temp--files that are created during upload.
Here is the code that makes the problem:
1) my $query = new CGI();
2) my $fh = $query->upload('FileInputName');
3) File::Copy::copy(*{$fh}, "../myDir/myFile.txt") or die "Can't copy uploaded picture '$fh': $!"; # that works
4) unlink(*{$fh}) or die "Can't remove uploaded temp file: $!"; # that does't work
In line 4) the unlink always failed with the message "No such file or directory".
(But the file cgitempXXX in temp-directory is still there!)
If I change line 3) into "File::Copy::move(.....)" I get the message "no permission ...".
What is the right way to move (== copy and delete) the temp-upload-file to
my own destination ???
Using currently for testing: perl 5.6.1 CGI.pm V2.93 on an Windows XP - Box
Thanks for helping
Jo
I'm using CGI.pm to make some file uploads to the web-server.
It works great, but the problem is that I'm not able to delete
the temp--files that are created during upload.
Here is the code that makes the problem:
1) my $query = new CGI();
2) my $fh = $query->upload('FileInputName');
3) File::Copy::copy(*{$fh}, "../myDir/myFile.txt") or die "Can't copy uploaded picture '$fh': $!"; # that works
4) unlink(*{$fh}) or die "Can't remove uploaded temp file: $!"; # that does't work
In line 4) the unlink always failed with the message "No such file or directory".
(But the file cgitempXXX in temp-directory is still there!)
If I change line 3) into "File::Copy::move(.....)" I get the message "no permission ...".
What is the right way to move (== copy and delete) the temp-upload-file to
my own destination ???
Using currently for testing: perl 5.6.1 CGI.pm V2.93 on an Windows XP - Box
Thanks for helping
Jo