Before downloading the attachment in IE, you need to clear the cache and encode the Chinese file name with urlencode. The following is a good example. if you need it, refer to the following:
1. clear the cache before downloading attachments in IE.
2. the Chinese file name must be URL encoded.
The code is as follows:
Header ("Pragma:"); // if it is not added, IE will prompt that the target host cannot be accessed.
Header ("Cache-Control:"); // if it is not added, IE will prompt that the target host cannot be accessed.
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); // garbled characters will appear in Chinese names without urlencode in IE
Readfile ($ path_c );
Exit;
Or
The code is as follows:
Header ('content-Description: File Transfer ');
Header ('content-Type: application/octet-stream ');
Header ('content-Disposition: attachment; filename = '. urlencode (basename ($ file); // garbled characters will appear in Chinese names without urlencode in IE
Header ('content-Transfer-Encoding: binary '); // binary Transfer
Header ('expires: 0 ');
Header ('cache-Control: must-revalidate, post-check = 0, pre-check = 0'); // if no value is added, IE will prompt that the target host cannot be accessed.
Header ('pragma: public '); // If this parameter is not added, IE will prompt that the target host cannot be accessed.
Header ('content-Length: '. filesize ($ file ));
Ob_clean ();
Flush ();
Readfile ($ file );
Exit;