用PHP打开下载对话框

时间:2009-06-12 05:01:50

标签: php download

我正在尝试制作一个在线kickstart配置文件创建者。在服务器上创建文件后,如何弹出下载对话框以便用户下载?

2 个答案:

答案 0 :(得分:16)

Content-Disposition header ..

// 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');

http://au2.php.net/manual/en/function.header.php

答案 1 :(得分:5)

神奇在于内容配置

send a file to client