使用标头下载到浏览器时的PHP问题 [英] PHP problem when dowloading to browser using headers
问题描述
我正在创建zip文件以通过恢复自定义rom进行更新.
我的网络应用程序创建了一个zip,如果我使用了它(从www/webapp复制到电话),一切正常.但是,当我通过浏览器下载它时,我会使用:($ zipfile是"something.zip")
I''m creating zip files to update through recovery of custom roms.
My web app creates a zip, if I use it (copying from www/webapp to phone) it''s all ok. But when I download it through browser, that I do using: ($zipfile is "something.zip")
// Send file headers
header("Content-type: application/zip");
header("Content-Disposition: attachment;filename=$zipfile");
readfile($zipfile);
我可以在PC上看到并打开它(看起来还可以),但是在手机上却显示无法打开something.zip-(不好).
我已经尝试了很多标头参数的组合,但是没有成功.该文件也比原始文件大几个KB(它在Webapp目录中有效)-我不知道这是不是应该的,但是有些不同.
I can see and open it in my PC (it looks perfectly ok) but in my phone I get "can''t open something.zip - (bad).
I already tried a lot of combinations of headers parameteres but no sucess. The file is also a couple KB larger than the original one (the one it works, at webapp directory) - i dont know if it''s suppose, but it''s something different.
Can you help me please?
推荐答案
zipfile是"something.zip")
zipfile is "something.zip")
// Send file headers
header("Content-type: application/zip");
header("Content-Disposition: attachment;filename=
zipfile" ); readfile(
zipfile"); readfile(
zipfile);
zipfile);
我可以在PC上看到并打开它(看起来还可以),但是在手机上却显示无法打开something.zip-(不好).
我已经尝试了很多标头参数的组合,但是没有成功.该文件也比原始文件大几个KB(它在Webapp目录中有效)-我不知道这是不是应该的,但是有些不同.
你能帮我吗?
I can see and open it in my PC (it looks perfectly ok) but in my phone I get "can''t open something.zip - (bad).
I already tried a lot of combinations of headers parameteres but no sucess. The file is also a couple KB larger than the original one (the one it works, at webapp directory) - i dont know if it''s suppose, but it''s something different.
Can you help me please?
这篇关于使用标头下载到浏览器时的PHP问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!