php - How to create a folder in laravel
Get the solution ↓↓↓laravel version 6.18.8
i used this line to make a directory but it say Method Illuminate\Filesystem\Filesystem::mkdir does not exist.
$newDirectory = public_path() . 'img/reviews/' . Str::slug($request->title,'-');
File::mkdir($newDirectory);
i also used makeDirectory() that was also not working..
please help to make a directory using laravel
Answer
Solution:
You may use phpmkdir
function
$dirPath = public_path('img/reviews/' . Str::slug($request->title,'-'));
if (!file_exists($dirPath)) {
mkdir($dirPath, 0777, true);
}
See How to create directory if not exists in Laravel 7.x and 6.x?
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: uncaught mysqli_sql_exception
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.