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

sbencze's avatar

Storage::makeDirectory and permissions

Hello

when I create a folder with Laravel the permissions are always set to 700 but I need 775 or 755

I have tried the following:

Storage::makeDirectory('public/img/'.$uuid, 'public');

Storage::makeDirectory('public/img/'.$uuid, 0775);

Storage::makeDirectory('public/img/'.$uuid, 0775, true);

Storage::makeDirectory('public/img/'.$uuid, 0775, true, true);

unfortunately all without success

I use laravel 10.33 with php 8.2.18

thanks for the help

0 likes
1 reply
sbencze's avatar

The Solution was in the config/filesystems.php

to add

'permissions' => [ 'file' => [ 'public' => 0775, 'private' => 0600, ], 'dir' => [ 'public' => 0775, 'private' => 0700, ]

and then use

Storage::makeDirectory('public/img/'.$uuid, 'public');

Please or to participate in this conversation.