PHP IE Download attachment problem solving method

Source: Internet
Author: User

  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;   

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.