Home  >  Article  >  Backend Development  >  Garbled characters appear in Chinese file names uploaded by php

Garbled characters appear in Chinese file names uploaded by php

WBOY
WBOYOriginal
2016-07-28 08:28:331106browse

1. The PHP upload file database saves files with normal Chinese file names. You can go to the server to check that the Chinese file names are garbled. I am puzzled and ask for help from Baidu.

2. Mainly due to inconsistent encoding during uploading. Garbled characters

3. It turns out that you only need to do this when moving_uploaded_file

move_uploaded_file($_FILES["file"]["tmp_name"],iconv("UTF-8", "gb2312", "photo/".$_FILES["file"]["name"]))

The above has introduced the garbled Chinese file name uploaded by PHP, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn