Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Mayaarjunan's avatar

Create a directory at runtime laravel 9

Hi, I want to create a directory that should have the name with the category name and a subfolder with userid as the name.I tried this with the below code

if(!Storage::exists($pdf_storage_path)){

                        Storage::makeDirectory(storage_path()."/app/uploads/".$catgeoryname."/dev/".$userId);
                    }

How can do this in laravel and can i use same for lumen 9? I am using windows 11, and php 8.0. I want to create this in the path app/uploads/ .

0 likes
1 reply
Mayaarjunan's avatar
Mayaarjunan
OP
Best Answer
Level 1

I solved this issue like this if(!Storage::disk('public')->exists($pdf_storage_path)){ Storage::makeDirectory("uploads/".$awsBucket."/dev"."/".$pdf_folder_name,0777, true); }

Please or to participate in this conversation.