先报错failed to open stream: Invalid argument
然后写入失败。
文档编码使用UTF-8
因为用英文文件试过,一切正常
试过各种iconv('xxx','xxx',$str);貌似无效
代码如下
if(is_uploaded_file($_FILES['userfile']['tmp_name'])){ echo '临时文件已经找到'; $name = $_FILES['userfile']['name']; $upload_path=$_SERVER['DOCUMENT_ROOT']."/upload/"; $dest_file=$upload_path.basename($_FILES['userfile']['name']); if (function_exists("iconv")) { $dest_file=iconv("UTF-8","GBK",$dest_file); } //iconv("UTF-8","GB2312//IGNORE",$name); //mb_convert_encoding($name, 'ANSI'); echo mb_detect_encoding($name); move_uploaded_file($_FILES['userfile']['tmp_name'], 'uploads'.'/'."$dest_file"); }else{ echo '找不到上传的文件'; }
慕田峪3216879