話說有一天,我用Luci寫一段download動態產生的檔案時,發生部分的IE8下載有問題,都會產生無法下載的訊息,當然就是立刻請問google大神,尋得此文章[PHP]下載檔案時無法直接開啟文件的解法方法,雖然是用PHP寫,不過小改一下就可以在Luci上面如法炮製啦。
[PHP]下載檔案時無法直接開啟文件的解法方法
header("Content-Type: application/octetstream; name=$FILEname"); //for IE & Opera
header("Content-Type: application/octet-stream; name=$FILEname"); //for the rest
header("Content-Disposition: attachment; filename=$FILEname;");
header("Content-Transfer-Encoding: binary");
header("Cache-Control: cache, must-revalidate");
header("Pragma: public");
header("Expires: 0");
Luci不過就是改呼叫luci.http.header()。[Luci]下載檔案時無法直接開啟文件的解法方法
luci.http.header("Content-Type", "application/octetstream; name=" .. fname); //for IE & Opera
luci.http.header("Content-Type", "application/octet-stream; name=" .. fname); //for the rest
luci.http.header("Content-Disposition", "attachment; filename=" .. fname);
luci.http.header("Content-Transfer-Encoding", "binary");
luci.http.header("Cache-Control", "cache, must-revalidate");
luci.http.header("Pragma", "public");
luci.http.header("Expires", "0");
- 參考資料
- [PHP]下載檔案時無法直接開啟文件的解法方法
- http://luci.subsignal.org/api/luci/modules/luci.http.html#header
 
 




 
 
 
 
 
 
 
