0 php gmail file download inbox
我的代码:
$zip_name="download.zip";
$ctype="application/zip";
// required for IE, otherwise Content-disposition is ignored
if(ini_get('zlib.output_compression'))
ini_set('zlib.output_compression', 'Off');
header("Pragma: public"); // required
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false); // required for certain browsers
header("Content-Type: $ctype");
// change, added quotes to allow spaces in filenames
header("Content-Disposition: attachment; filename=\"".basename($zip_name)."\";" );
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($zip_name));
readfile("$zip_name");
Run Code Online (Sandbox Code Playgroud)
现在文件下载在Downloads文件夹中.
我需要下载D:驱动器中的所有文件.
这是不可能的.网络服务器无法告诉客户端保存文件的位置.想象一下,如果站点可以指定文件保存操作的确切位置,则会产生安全隐患.
请参阅RFC 2183,第2.3节:
接收MUA不应该尊重
文件名参数中可能出现的任何目录路径信息.文件名
应仅被视为终端组件.目前
路径的可移植规范可能在将来通过单独的Content-Disposition参数完成,但
在此草案中没有为它做出规定.
归档时间: |
|
查看次数: |
2436 次 |
最近记录: |