Hi, Here is the code

<?php

$filenm = '/var/tmp/';

$s = 1;
$q =2;


switch( $_POST["submit"] )
{
case 's':
$filenm .= 's.tab';
//create $filenm
break;
case 'q':
$filenm .= 'q.tab';
//create $filenm
break;
}


/*
echo "file name = {$filenm}<br>\n";
echo "base name = ", basename($filenm), "<br>\n";
echo "file size = ", filesize($filenm), "<br>\n";
echo "file name = {$filenm}<br>\n";
*/

$sname = basename($filenm);
header("Content-Type: application/octet-stream");
header('Content-Disposition: attachment; filename=' . $sname);
header('Content-Transfer-Encoding: binary');
header('Content-Length: '.filesize($filenm));
readfile($filenm);

unlink($filenm);
?>


Thanks

Reply via email to