Upload file name Chinese failed, how to deal with

Source: Internet
Author: User
Upload file name Chinese failed
$dir = $_server[' Document_root '). " /uploads/";
Uploaded file Rename
$filename = $_files[$myfile [' name '];
$filename = mb_convert_encoding ($_files[$myfile [' name '], "UTF-8", "GBK");
$filename = Iconv ("gb2312", "UTF-8", $_files[$myfile [' name ']);
echo $filename;d ie;
Upload the file function move_uploaded_file (file temp directory, file loaded directory)
if (Move_uploaded_file ($_files[$myfile [' Tmp_name '], $dir. $filename)) {
Unzip upload file
Dp_unzipfile ($filename, $path);
echo "File upload succeeded";
}else{
echo "Failed to upload the file";
}

------Solution--------------------
PHP Code
The path under Windows is like this: d:\\webservice\\doc.juren9.com\\uploads\\ room Aston ziplinux:#/webservice/doc.juren9.com/uploads/ Room Aston Zip.gz.
------Solution--------------------
discuss
$dir = $_server[' Document_root '). " /uploads/";
Uploaded file Rename
$filename = $_files[$myfile [' name '];
$filename = mb_convert_encoding ($_files[$myfile [' name '], "UTF-8", "GBK");
$filename ...

------Solution--------------------
$_files[$myfile] Print it out to see
------Solution--------------------
This is the project I am doing upload pictures of the file, you take to use it!!
PHP Code
/*** function: * Upload picture * parameter Description: * $imgpath: File variable * return value: * 1: $imgpath upload image after successful full picture path * 2:false upload picture failed * 2:false    Failed to upload image * Version: * v1.0 August 5, 07 for the 1th time, */function Upload_image ($imgpath) {$name = $imgpath ["name"];    $tmp _name= $imgpath ["Tmp_name"];    $type = $imgpath ["type"];    $size = $imgpath ["Size"]; $uploadfile = ".   /index/upload_image/". $imgpath [' name ']; Time (). "   _".                                           The location of the upload $maxsize =500*1024;    Maximum allowable file size if ($name = = "") {//File name is empty echo "";        if ($size > $maxsize) {//exceeds the specified size echo "";    Exit    } if (Move_uploaded_file ($tmp _name, $uploadfile)) return $uploadfile;    else if (copy ($tmp _name, $uploadfile)) return $uploadfile;    else return false;  The}//upload_image function section calls this function on the page where you need to upload the image//if it is not a page do not forget to include this file on that page $photo =$_files[' photo '; Upload_image ($photo);? >
------Solution--------------------
Just repeat the name.
  • 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.