bitcodr
bitcodr

Reputation: 1454

Upload file error in lumen

I use laravelUploader package form this link for upload my files . when i use this package to send file in lumen with below code :

$file = $this->uploader->file($request->file('file'))->push(storage_path('app'));
return $this->respondCreated(['data'=>$file->getFullPath()]);

i got an error like :

BindingResolutionException in Container.php line 752:
Target [Illuminate\Contracts\Filesystem\Factory] is not instantiable while building [Almazik\LaravelUploader\LaravelUploader].

now how can i fix it?

Upvotes: 0

Views: 2713

Answers (1)

krisanalfa
krisanalfa

Reputation: 6438

Bind implementation of Illuminate\Contracts\Filesystem\Factory using this snippets.

$app->singleton(
    Illuminate\Contracts\Filesystem\Factory::class,
    function ($app) {
        return new Illuminate\Filesystem\FilesystemManager($app);
    }
);

Note: You can do this in your bootstrap/app.php file right after you register Almazik\LaravelUploader\FileUploaderServiceProvider.

Upvotes: 6

Related Questions