2011-12-21 77 views

回答

2

有一种方法,使用header()调用来指定Content-Disposition

例如,我有一个形象的下载脚本,看起来像这样:

header("Content-Type: $mime"); 
header("Content-Disposition: attachment; filename=\"foobar.baz\""); 
readfile($filename); 

你需要找出MIME类型的文件是什么(用Content-Type: $mime设置,告诉浏览该文件是使用Content-Disposition头附件,然后再输出readfile()文件。

This tutorial对此事的更多信息。

+0

非常感谢你们,对不起,我新来堆栈溢出,真的不知道从哪里开始。 – saoud 2011-12-21 06:41:15