Reputation: 12015
I get the following error:
{"errors":"Method Illuminate\\Filesystem\\Filesystem::create does not exist."}
Imports are:
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\File;
Code is:
$created = File::create(["path" => $path.$filename]);
Upvotes: 0
Views: 3895
Reputation: 1369
If you will look to an official laravel API, there is no such method ::create on File facade.
https://laravel.com/api/5.8/Illuminate/Filesystem/Filesystem.html
What are you trying to achieve ?
If you want to create a new file use ::put method:
int|bool put(string $path, string $contents, bool $lock = false)
look at API link that I've provided. Or check official docs
Upvotes: 2
Reputation: 1752
to save file uploading from a form, simply use Storage
use Illuminate\Support\Facades\Storage;
$path = Storage::putFile('path/avatars', $request->file('avatar'));
Upvotes: 1