求教:关于文件下载
我想实现下面的功能:
某目录下已经存在文件"file1.rar",做一个"download.php",通过它下载"file1.rar",同时将下载名改为"file2.rar"。就是说,点击"download.php"时,提示“文件保存为‘file2.rar'”。
为了减少服务器负担,不能用PHP先读出file1.rar的内容在输出,而要直接连接。如果象下面这样,文件太大的话就不理想了:
Header("Content-type: application/octet-stream");
Header("Content-Disposition: attachment; filename=file2.rar");
echo $content_of_file1_rar;