文件上传

This commit is contained in:
sugar1569 2018-09-29 09:17:11 +08:00
parent 3d79fcba0c
commit 76000e3434

View File

@ -79,8 +79,8 @@ class UploadService
*/
protected static function uploadDir($path, $root=null)
{
if($root === null) $root = PUBILC_PATH.'uploads';
return ltrim($root . DS . $path,'/');
if($root === null) $root = 'public/' . 'uploads';
return $root . DS . $path;
}
/**
@ -98,7 +98,6 @@ class UploadService
self::init();
$path = self::uploadDir($path,$root);
$dir = ROOT_PATH . $path;
echo $path;echo $dir;
if(!self::validDir($dir)) return self::setError('生成上传目录失败,请检查权限!');
if(!isset($_FILES[$fileName])) return self::setError('上传文件不存在!');
$file = request()->file($fileName);