PHP IE Download attachment problem solving method

Source: Internet
Author: User
Tags empty readfile urlencode

  in IE to download the attachment before you empty the cache, Chinese file name to use UrlEncode encoding, there is a good example, the need for friends can refer to the following

Key:    1, empty the cache before downloading the attachment in IE.     2, Chinese file name to be encoded with UrlEncode.   Code as follows: Header ("Pragma:"); If not, IE will prompt the target host can not access   Header ("Cache-control:"); If not, IE will prompt the target host to be unable to access   header ("Content-type: $type");  header ("accept-ranges:bytes");  header (" Content-transfer-encoding:base64 ");  Header (" Accept-length: "). FileSize ($path _c));  Header ("content-disposition:attachment; Filename= ". UrlEncode ($filename)); In IE without urlencode Chinese name will appear garbled   ReadFile ($path _c);  exit;    or   code as follows: Header (' Content-description : File Transfer ');  header (' Content-type:application/octet-stream ');  header (' Content-disposition: attachment; Filename= '. UrlEncode (basename ($file))); In IE without urlencode Chinese name will appear garbled   header (' content-transfer-encoding:binary '); Binary transmission   Header (' expires:0 ');  header (' Cache-control:must-revalidate, post-check=0, pre-check=0 '); If not, IE will prompt the target host can not access   header (' pragma:public '); If not, IE will prompt the target host to be unable to access   header (' ConTent-length: '. FileSize ($file));  Ob_clean ();  flush ();  ReadFile ($file);  exit;   
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.