开发者

php header() function problem about download file

开发者 https://www.devze.com 2023-02-04 22:12 出处:网络
I have a file download function in my website. it works fine before. but after we moved the site to another server with runs PHP 5 (it runs on PHP 4 before). when click to download, it automatically a

I have a file download function in my website. it works fine before. but after we moved the site to another server with runs PHP 5 (it runs on PHP 4 before). when click to download, it automatically adds a extra blank lin开发者_开发技巧e at the beginning and the end of the file which we don't want to. Here is the code for downloading function:

header("Content-Type: application/gas");
header("Cache-control: private");    
header("Content-Disposition: attachment; filename=aaa.gas");

Could anyone please help me out? Thanks!


There may be an extra blank line after the ?> that closes the PHP within the script. Exit the script after sending the file in order to prevent this from mattering.

0

精彩评论

暂无评论...
验证码 换一张
取 消