How to create directory in laravel 6 ?

Laravel 6 , Laravel

Nicesnippets

818

27-09-2019


hi guys,

In this example, i will show you create folder in laravel 6. we can easily create directory in laravel 6. we can solved simply define the command then create directory in laravel 6.

you are just trying to use File::makeDirectory to create folder from public path.

solution for laravel

/**

* Show the application dashboard.

*

* @return \Illuminate\Contracts\Support\Renderable

*/

public function index(Request $request)

{

$file = public_path('image');

$result = File::makeDirectory($file);

dd($result);

}

If return true this method success, return false this method fails.

solution for php

/**

* Show the application dashboard.

*

* @return \Illuminate\Contracts\Support\Renderable

*/

public function index(Request $request)

{

$file = public_path('images');

$result = mkdir($file);

dd($result);

}

If return true this method success, return false this method fails.

It will help you...


Recommended Posts