In this post, we will guide you how to create folder in storage in laravel 6 application. we can easily create directory if not exists using File or Storage facade in laravel 6 project. i will give you simple and more solution of laravel 6 make folder in public folder or storage folder.
I will give you more way to create folder in public folder in laravel 6. you can see i will use File facade to create folder, Storage facade will use to create directory from storage in laravel 6 and also i will give you simple code core php to create folder.
Using File System:
public function createDirecrotory(Request $request)
{
$path = public_path('upload/itsolutionstuff.com');
if(!File::isDirectory($path)){
File::makeDirectory($path, 0777, true, true);
}
dd('done');
}
Using Storage System:
public function createFolder()
{
$response = Storage::makeDirectory('upload/itsolutionstuff.com');
dd($response);
}
Using Core PHP:
public function removeFolder()
{
$folderPath = public_path('uploads');
$response = mkdir($folderPath);
dd($response);
}
It will help you...
Do you like below Tutorials ?
- PHP Laravel 5.5 - import export data into excel and csv using maatwebsite
- Laravel 7.x and 6.x create custom facade example from scratch
- Node JS - Get Real time online users counter using socket io example
- PHP Laravel 7.x and 6.x - Bootstrap Admin Theme Integration example from scratch
- MySQL Query - How to select records of today to next Sunday ?
- Laravel 7.x and 6.x - username custom validation example
- Laravel 5.5 - Import Extract zip file using chumper/zipper package
- PHP Laravel Set Custom Validation Error Messages Example