将文件发送给用户
问题描述:
如何将文件发送给用户,以便他们可以选择目录和文件名。下面的代码让用户下载文件,但不允许在Firefox中选择目录。我该如何解决它?将文件发送给用户
// We'll be outputting a PDF
header('Content-type: application/pdf');
// It will be called downloaded.pdf
header('Content-Disposition: attachment; filename="downloaded.pdf"');
// The PDF source is in original.pdf
readfile('original.pdf');
答
Edit
| Preferences
| Applications
| PDF Document
| Always Ask
答
这是浏览器中的设置。您无法通过您的PHP代码强制执行此操作。要更改设置,请访问:
Edit > Preferences > Main > Downloads
和检查Always ask me where to save files
答
你试过吗?
header("Content-Type: application/force-download");
Ignacio Vazquez-Abrams,仍然不起作用。顺便说一句,“总是问”已经设置好了。 – roney 2011-04-26 01:06:01