0

In PHP, we can do something like

<?php
 header("Location: https://www.example.com/test.exe");
?>

to download a file. However, the URL will be visible in a download manager such as DAP. So is there really a way to hide the download URL altogether?

4

1 回答 1

0
//This will help you

<?php
$fullpath = 'https://www.example.com/test.exe';
$filename ='test.exe';
header("Cache-Control: public, must-revalidate");
header("Content-Type: application/exe");
header("Content-Length: " .(string)(filesize($fullpath)) );
header('Content-Disposition: attachment; filename="'.$filename.'"');                 
readfile($fullpath);
?>

MIME 类型信息

http://fileext.com/file-extension/EXE

于 2013-07-26T06:47:27.060 回答