Hello,

I have a PHP script that automatically downloads a file from a hyper link:
<a href="./download.php?file=somefile.pdf">down load here</a>
CODE:
############################################################
//* path to download folder *//
$filedir = '../temp/';
$filename = basename($_GET['file']);
$path = $filedir . $filename;
if (!is_file($path) OR connection_status() != 0) {  exit(); }

ob_end_clean();

header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Expires: '. gmdate('D, d M Y H:i:s', mktime(date('H')+2, date('i'), date('s'), date('m'), date('d'), date('Y'))).' GMT');
header('Last-Modified: '. gmdate('D, d M Y H:i:s').' GMT');
header('Content-Type: application/octet-stream');
header('Content-Length: '. @filesize($path));
header('Content-Disposition: attachment; filename="'. $filename .'"');
header('Content-Transfer-Encoding: binary');

if ($file = @fopen($path, 'rb'))
{
   while (!feof($file) AND connection_status() == 0)
   {
       echo fread($file, 1024 * 8);
   }
flush();
}
@fclose($file);
###############################################################

I've been trying to convert this to a Perl script with not much luck. Was hoping to get some tips on how to convert this to Perl or a similar method using Perl so when the link is clicked on, the file will be automatically downloaded instead of clicking on the link to do a "Save As".

TIA
Mike(mickalo)Blezien
===============================
Thunder Rain Internet Publishing
Providing Internet Solution that Work
===============================

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to