Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/295.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 无法将FilesystemAdapter转换为字符串Laravel_Php_Laravel_Laravel 5.2 - Fatal编程技术网

Php 无法将FilesystemAdapter转换为字符串Laravel

Php 无法将FilesystemAdapter转换为字符串Laravel,php,laravel,laravel-5.2,Php,Laravel,Laravel 5.2,我有一张照片上传表,这张表的代码是 $this->validate($request, [ 'image' => 'required|image|max:3000|mimes:jpeg,jpg,png', ]); $user = Auth::user(); $usersname = $user->username; $file = $request->file('image');

我有一张照片上传表,这张表的代码是

$this->validate($request, [
            'image' => 'required|image|max:3000|mimes:jpeg,jpg,png',
        ]);
        $user = Auth::user();

        $usersname = $user->username;
       $file = $request->file('image');
      $ext = $file->getClientOriginalExtension();
      $path = Storage::disk('uploads');

        $filename = $usersname . '.' . $ext;

        if (Storage::disk('uploads')->has($filename)) {
            Storage::delete($filename);
        }
       Storage::disk('uploads')->put($filename, File::get($file));

       $resizedImg = Image::make($path . DIRECTORY_SEPARATOR . $filename)->resize(200,200)->save($path . DIRECTORY_SEPARATOR . $filename);

        return redirect()->route('profile.index', 
                ['username' => Auth::user()->username]);
    }
当我执行这段代码时,它会给我这个错误

ErrorException in ProfileController.php line 71:
Object of class Illuminate\Filesystem\FilesystemAdapter could not be converted to string
第71行是以$resizedImg开头的行,但是照片确实保存到了正确的目录中,只是没有调整大小

我在filesystems.php文件中定义了如下上载

 'disks' => [

        'uploads' => [
            'driver' => 'local',
            'root'   => public_path('/uploads'),
        ],

$path
内容驱动程序,但您试图将其用作字符串,这就是问题所在。尝试使用类似以下内容:

$path = '/uploads';