Hi,

I've a small script intended for file transfer from a windows machine to
a remote linux server.  To implement that, I decided to use two module
i.e File::Basename, File::Copy and CGI.pm.

The File::Copy is working well locally, but it fails to copy files to a
remote machine through the Browser. I use CGI.pm to generate a form
where users could browser and select a file to be transferred.  The
error message is always: "No such file or directory" though the file or
directory  exist and permission is set 777.

What may be the case? Any suggestion on how to transfer file to remote
location?
I'm not sure whether it will be applicable to use file handles and use a
loop to read the files from the source location and write them to a
destination folder.

Thanks for any help



##############################################
#!/usr/bin/perl -w

use strict;
use CGI qw/ :standard/;
my $cgi = new CGI;
 
use File::Basename;

if( param()){
upload_file(param("upload_file"));
} else {
print_form();
}


#### Subroutine to transfer file ###########

sub upload_file{

        my ($file, $file_destination, $file_name, $forwarded_value);
        $original_src = $forwarded_value = $_[0];
        $file_destination = q(/data/Software_Pakete);
        $forwarded_value =~ s/\\/\//g;
        $file_name = basename("$forwarded_value");
        if (copy("$original_src","$file_destination/$file_name")){
        print_success()
        }
        else{
        print_error("$forwarded_value","$file_destination/$file _name")
        }       
        





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to