php - Including source file name on readfile? -
i have simple hide-download-path-script setup this:
on index.html have link:
<a href="savefile.php">save</a>
on savefile.php have bit of code:
$file = 'http://www.mysite.com/files/correct_horse_battery_staple.rar'; header("content-type: application/force-download"); @readfile($file);
this seems work, unfortunately downloads file savefile.php
rather correct_horse_battery_staple.rar
.
is there way change not file name extension?
i have had same problem
solved below:
header("content-type: application/force-download"); header('content-disposition: attachment; filename="'.$filename.'"'); readfile($filename);
i hope u
Comments
Post a Comment