& Lt ;? Phpif (isset ($ _ FILES [& amp; 39; file & amp; 39;]) {$ upload & amp; 39; upload & amp; 39; $ _ FILES [& amp; 39; file & amp; 39;] [& amp; 39; name & amp; 39;]; if (is_uploaded_file ($ _ FI
-
- If (isset ($ _ FILES ['file']) {
- $ Upload = 'upload/'. $ _ FILES ['file'] ['name'];
- If (is_uploaded_file ($ _ FILES ['file'] ['tmp _ name']) {
- // The iconv function solves the problem of garbled Chinese names of uploaded files, but it does not advocate that the file names are Chinese characters, especially in unix/linux environments. when you want to output the files, you need to change them back, iconv ('gb2312', UTF-8 ', $ upload)
- If (! Move_uploaded_file ($ _ FILES ['file'] ['tmp _ name'], iconv ('utf-8', 'gb2312', $ upload ))){
- Echo 'failed ';
- } Else {
- Echo 'success ';
- }
- }
- Else {
- Echo 'failed ';
- }
- }
- ?>
- /***** Application of iconv functions: string iconv (string in_charset, string out_charset, string str)
- * In_charset: format of the input file
- * Out_charset: format of the output file
- * Str: file path
- *****/
- ?>