chrismassey
Programmer
Hello,
I have written a script which lets me download individual files from my web server to a PC, however I want to be able to download entire diriectories rather than individual files. Here is the script to download an individual file...
Thanks
I have written a script which lets me download individual files from my web server to a PC, however I want to be able to download entire diriectories rather than individual files. Here is the script to download an individual file...
Code:
#! /usr/bin/perl
use strict;
use CGI ':standard';
use CGI::Carp qw(fatalsToBrowser);
my $files_location;
my $ID;
my @fileholder;
$files_location = "/PATH/chrismassey.co.uk/Perl/Scripts/ControlPanelV1.0/";
$ID = "z/Properties/Images/Logo1.bmp";
if ($ID eq '') {
print "Content-type: text/html\n\n";
print "You must specify a file to download.";
} else {
open(DLFILE, "<$files_location/$ID") || Error('open', 'file');
@fileholder = <DLFILE>;
close (DLFILE) || Error ('close', 'file');
print "Content-Type:application/x-download\n";
print "Content-Disposition:attachment;filename=$ID\n\n";
print @fileholder
### end else
}
sub Error {
print "Content-type: text/html\n\n";
print "The server can't $_[0] the $_[1]: $! \n";
exit;
}
Thanks