소스 검색

文件上传

sugar1569 7 년 전
부모
커밋
76000e3434
1개의 변경된 파일2개의 추가작업 그리고 3개의 파일을 삭제
  1. 2 3
      extend/service/UploadService.php

+ 2 - 3
extend/service/UploadService.php

@@ -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);