PHP Upload file name contains Chinese characters in the attachment

Source: Internet
Author: User
When we upload attachments, we often upload some attachments with the name of the attachment, the upload is successful, you will find that the uploaded attachment is actually an empty file. I've come across this kind of problem.

Let's solve this kind of problem.

Solving this kind of problem is actually very simple.

For example, our PHP code is utf-8, as long as we are in the Move_uploaded_file (), we will save the attachment path encoding for the same as PHP code can be resolved

The following code can be solved

Move_uploaded_file ($file ["Tmp_name"], Iconv ("Utf-8", "Utf-8", $filename));

The following code may appear empty attachments

Move_uploaded_file ($file ["Tmp_name"], $filename);

Record it again so that it won't be tangled up again.
  • Related Article

    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.