修正request类的file方法

This commit is contained in:
thinkphp
2016-06-21 11:53:38 +08:00
parent 70f146f3e3
commit 2281f1edb4
2 changed files with 51 additions and 51 deletions

View File

@@ -48,7 +48,7 @@ class File extends SplFileObject
/** /**
* 设置上传信息 * 设置上传信息
* @param bool $info 上传文件信息 * @param array $info 上传文件信息
* @return $this * @return $this
*/ */
public function setUploadInfo($info) public function setUploadInfo($info)

View File

@@ -12,9 +12,9 @@
namespace think; namespace think;
use think\Config; use think\Config;
use think\Exception;
use think\File; use think\File;
use think\Session; use think\Session;
use think\Exception;
class Request class Request
{ {
@@ -810,7 +810,7 @@ class Request
if (empty($val['tmp_name'])) { if (empty($val['tmp_name'])) {
continue; continue;
} }
$item[$key] = new File($val['tmp_name'])->setUploadInfo($val); $item[$key] = (new File($val['tmp_name']))->setUploadInfo($val);
} }
} }
return $item; return $item;
@@ -818,7 +818,7 @@ class Request
if ($array[$name] instanceof File) { if ($array[$name] instanceof File) {
return $array[$name]; return $array[$name];
} elseif (!empty($array[$name]['tmp_name'])) { } elseif (!empty($array[$name]['tmp_name'])) {
return new File($array[$name]['tmp_name'])->setUploadInfo($array[$name]); return (new File($array[$name]['tmp_name']))->setUploadInfo($array[$name]);
} }
} }
} }