arun_amiable has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
We are trying to upload multiple files on the server. For this we are reading filenames from a text file and uploading those files in a loop' but below mentioned code is not working please help
#!/usr/bin/perl use CGI qw(:standard); my $cgi = new CGI; my $upload_dir ='/home/gecko/www/htdocs'; my $des_dir ='/home/gecko/geckodev/cgi-bin/uploads'; my $file = $cgi->param('pi_file_name'); my $filename = $file; $filename =~ s/^.*(\\|\/)//g; open(FILELIST,"<$filename") || die print "Fail to upload: $!"; while(<FILELIST>) { $line=$_; chomp($line); my $doc = $line; $doc =~ s/^.*(\\|\/)//g; $line =~ s/^.*(\\|\/)//g; open(OUT,">$upload_dir/$doc") || die print "Fail to upload: $!"; + open(FILELIST1,"<$line") || die print "Fail to upload: $!"; while(<FILELIST1>) { print OUT $_; # print $_; print $cgi->header(); print "<HTML>"; print $_; print "<BODY bgcolor=#FFFFFF>"; print "<BODY bgcolor=#FFFFFF>"; print "</BODY>"; print "</HTML>"; } close(OUT); }
20050606 Janitored by Corion: Added formatting
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Upload Multiple Files
by thundergnat (Deacon) on Jun 06, 2005 at 14:58 UTC | |
|
Re: Upload Multiple Files
by derby (Abbot) on Jun 06, 2005 at 19:42 UTC | |
by Anonymous Monk on Jun 07, 2005 at 13:30 UTC | |
by arun_amiable (Initiate) on Jun 08, 2005 at 07:44 UTC | |
|
Re: Upload Multiple Files
by reasonablekeith (Deacon) on Jun 06, 2005 at 14:33 UTC |