php utf8编码上传中文文件名出现乱码
下面我来总结一下php utf8编码上传中文文件名出现乱码解决办法,有碰这类问题的朋友可参考参考。
代码如下 | 复制代码 |
if(isset($_FILES['file'])){ if(is_uploaded_file($_FILES['file']['tmp_name'])){ //iconv函数解决上传文件中文名乱码的问题,但是不提倡文件名是中文的,特别是unix/linux环境下 ,当你要输出的时候,又要给变回来,iconv('gb2312',UTF-8',$upload) if(!move_uploaded_file($_FILES['file']['tmp_name'],iconv('UTF-8','gb2312',$upload))){ echo 'failed'; }else{ } } } /******关于iconv函数的应用:string iconv ( string in_charset, string out_charset, string str ) * out_charset:输出的文件的格式 * str:文件路径 *****/ |

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

WebStorm Mac version
Useful JavaScript development tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Notepad++7.3.1
Easy-to-use and free code editor