In the WinDOS Chinese system, the required parameters if the Chinese must be GBK encoded
1. Use Iconv () to convert the character set code as follows
$target _pt = './uploads/'. Uniqid (). ' -'. $images [' name '];//windows supports Chinese name upload $upload_file_pt = Iconv ("UTF-8", "GB2312", $target _pt); if (!move_uploaded_file ($images [' Tmp_name '], $upload _file_pt)) {$GLOBALS [' error_message '] = ' upload failed '; return;}
2, take the name directly with Uniqid () to get the name, with PathInfo () to obtain the suffix code as follows
$ext =pathinfo ($_files[' Avatar ' [' Name '], pathinfo_extension); $target = ' uploads/'. Uniqid (). '. $ext, if (!move_uploaded_file ($_files[' Avatar ' [' Tmp_name '], $target)) {$GLOBALS [' error_message '] = ' failed to upload file '; return;}
php function Move_uploaded_file () the solution to the error in moving Chinese files