rahulhaque / laravel-filepond

Use FilePond the Laravel way.
MIT License
185 stars 31 forks source link

Attempt to read property "disk" on null" #2

Closed aligulzar729 closed 3 years ago

aligulzar729 commented 3 years ago

Dear Sir When I'm trying to move and validate or any other methods after field() it throws null errors.

Filepond::field($request->input('logo_url'))->validate(['logo_url' => 'required|image|max:3000']);
        $fileName = \Str::random(20) . '_brand';
        $destination = 'uploads/brand/';
$fileInfo = Filepond::field($request->input('logo_url'))
        ->moveTo($destination . $fileName);

Any help will be appreciated.

rahulhaque commented 3 years ago

Need more details. Please, provide the following.

  1. Value of $request->input('logo_url')
  2. Screenshot of the error or error file and line number.
aligulzar729 commented 3 years ago

Fixed the previous one but now I'm facing this: I want to move files to uploads/brand but this happens: copy(C:\\laragon\\www\\GulfinAPI\\public\\uploads/brand/1630473146_brand_YdFTaOv4DZfPSbXPsxuW.jpg): Failed to open stream: No such file or directory

 // For single file validation
        Filepond::field($request->input('logo_url'))->validate(['avatar' => 'required|image|max:2000']);

        $fileName = time() . "_brand_" . \Str::random(20);
        $path = 'uploads/brand/';
        $fileInfo = Filepond::field($request->input('logo_url'))
            ->moveTo($path . $fileName);

        dd($fileInfo);
aligulzar729 commented 3 years ago

And the value of $request->input('logo_url') is: "eyJpdiI6IkV1R01BUEd6WFpnZCt5VVJHbFE3c3c9PSIsInZhbHVlIjoiVGhDVytES3hrcmFQd0tyZnRILzB2YUprNVNNSzgzM0t0VXp1bHVmWGZNST0iLCJtYWMiOiI0NzU1ZDU4NDYwMTY3MTNhZmRhZjlhYmZhZDgwNDkxMjcwYWRmMTJiYWM5ZTMzMjQyNDE4NDg2Yjg0N2M4MTE0In0="

rahulhaque commented 3 years ago

The folder you're trying to move your files to doesn't exist. Create the folder and make sure you're directing to the correct path.

aligulzar729 commented 3 years ago

The folder you're trying to move your files to doesn't exist. Create the folder and make sure you're directing to the correct path.

image

It exists in public

rahulhaque commented 3 years ago

This is not a package issue. Read more about folder and directory access in laravel. Use public_path helper described here.

aligulzar729 commented 3 years ago

Sorry. But thanks BTW.