In html just create a button and link this php code to it
<?php
$filename ="htmlquestions.rar"; -->specify the file which you want to download
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.$filename.'"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($filename));
flush(); // Flush system output buffer
readfile($filename);
exit;
?>
Note:- the file you want to download must be present in same directory
<?php
$filename ="htmlquestions.rar"; -->specify the file which you want to download
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.$filename.'"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($filename));
flush(); // Flush system output buffer
readfile($filename);
exit;
?>
Note:- the file you want to download must be present in same directory
0 Comments