In this Article, we will guide you how to create folder in storage in laravel 8 application. we are able to without difficulty create directory if now not exists the use of File or Storage facade in laravel 8 project. i can give you easy and extra solution of laravel 8 make folder in public folder or storage folder.
i'm able to come up with extra way to create folder in public folder in laravel 8. you may see i can use File facade to create folder, Storage facade will use to create directory from storage in laravel 8 and also i'm able to provide you with easy code core php to create folder.
Using File System:
public function createDirecrotory(Request $request)
{
$path = public_path('upload/laravelcode.com');
if(!File::isDirectory($path)){
File::makeDirectory($path, 0777, true, true);
}
dd('done');
}
Using Storage System:
public function createFolder()
{
$response = Storage::makeDirectory('upload/laravelcode.com');
dd($response);
}
Using Core PHP:
public function removeFolder()
{
$folderPath = public_path('uploads');
$response = mkdir($folderPath);
dd($response);
}