How to create a folder in laravel?

by giovanny.lueilwitz , in category: PHP Frameworks , 10 months ago

How to create a folder in laravel?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by dedrick , 10 months ago

@giovanny.lueilwitz 

To create a folder in Laravel, you can use the Storage facade provided by Laravel. Here's how you can create a folder using this facade:

1
2
3
use IlluminateSupportFacadesStorage;

Storage::makeDirectory('path/to/directory');


Replace 'path/to/directory' with the path of the folder you want to create. This will create a new folder in the storage/app directory of your Laravel application.


Alternatively, you can create a folder using PHP's mkdir() function as well:

1
mkdir(storage_path('app/path/to/directory'));


This will create a folder in the storage/app directory of your Laravel application.


Remember to give proper permissions to the newly created folder so that Laravel can read and write to it.

Related Threads:

How to create folder on bitbucket?
How to create zip folder in Codeigniter?
How to delete folder in laravel?
How to upload folder in laravel?
How to gzip folder in laravel project?
How to redirect to separate folder in laravel?