===== PHP Upload function ======

Source: Internet
Author: User
===== PHP download function =====& lt ;? Phpheader ('content-type: & nbsp; video/mpeg4'); // output type header ('content-Disposition: & nbsp; attachment; & nbsp; filename = "file name .mp4" '===== PHP download function ====

Header ('content-type: video/mpeg4'); // output type
Header ('content-Disposition: attachment; filename = "file name .mp4" '); // name displayed for download
Readfile('file name .mp4 ');
?>

This is a piece of download code for my use.
However, when the file name is in Chinese, the name displayed in the Download box and after the download is garbled.
Is PHP not recognizing Chinese characters in this download function?

How can I modify the PHP download function to download files with Chinese names? Php header download
------ Solution --------------------
Whether garbled characters are displayed depends on the default character set of the user's operating system.
------ Solution --------------------
Header ("Content-type: text/html; charset = utf-8 ");

------ Solution --------------------
Url_encode transcodes the file name before executing the download program.
------ Solution --------------------
The two upstairs are here to disturb the situation ~
------ Solution --------------------
You can check the php file format. the file format is consistent with the code encoding format. otherwise, garbled characters will occur.

If your php file is utf8, add the header ("Content-type: text/html; charset = utf-8"); top
------ Solution --------------------
You can try transcoding your downloaded file name iconv ().

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.