in reply to Download Files Server by PERL?

Here's a bit of working code snipped from a larger script that may help you get started. You'll need to supply some values and do some rewriting (for example, it looks to me like some of the needed 'my' statements preceed this snippet)...

# First set up a few values for the download header my ($sec, $min, $hr, $day, $mon, $yr, $wday) = (gmtime()); $sec = sprintf("%2.2d", $sec ); $min = sprintf("%2.2d", $min ); $hr = sprintf("%2.2d", $hr ); $day = sprintf("%2.2d", $day ); $yr = sprintf("%4.4d", ($yr+1900)); $mon = ('Jan','Feb','Mar','Apr','May','Jun', 'Jul','Aug','Sep','Oct','Nov','Dec')[$mon]; $wday = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat')[$wday]; my $server = $ENV{SERVER_SOFTWARE}; $server =~ s/^(\S+)//; # #. . . omitted some code here # # Now do the download open DOWNLOAD, "<$upload_dir/$dir/$filename" or die "Can't open $upload_dir/$dir/$filename\n"; my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev, $size,$atime,$mtime,$ctime,$blksize,$blocks) = stat DOWNLOAD; print "Date: $wday, $day $mon $yr $hr:$min:$sec GMT\n"; print "Server: $server\n"; print "MIME-version: 1.0\n"; print "Content-type: $content_type\n"; print "Content-length: $size\n"; print "\n"; binmode STDOUT; while (read(DOWNLOAD, $buffer, $buffer_size)) { print $buffer; } close DOWNLOAD;
Also, take koo's comment very seriously. Make sure you have a robust mechanism for screening what can be downloaded.

Hope this helpes.