Ver Fonte

上传文件名,如果涉及到中文就URL编码

Zhu Jinhui há 7 anos atrás
pai
commit
b29e13fc07
1 ficheiros alterados com 2 adições e 1 exclusões
  1. 2 1
      src/Library/Upload.php

+ 2 - 1
src/Library/Upload.php

@@ -408,7 +408,8 @@ class Upload
                 return $data;
             }
         }
-        $realPath = rtrim($fillPath, '/') . '/' . toGBK($configure['fileName']);
+        //将文件名转换成URL编码,防止移动文件不成功的情况
+        $realPath = rtrim($fillPath, '/') . '/' . urlencode($configure['fileName']);
         if ($files['binary']) {
             $result = rename($files['tmp_name'], $realPath);
         } else {