Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP mkdir issue!

I trying to create some dirs like this:

@mkdir("photos/$cat/$sku", 0777, true)

it creates the first directory with 0777 permissions, but when it creates the second is uses 000 as it's perms, so it fails to create the third.

A workaround this please?

Thanks, Richard.

like image 721
richardalberto Avatar asked May 22 '26 16:05

richardalberto


1 Answers

This solved the issue:

$a = @mkdir("photos/$cat/", 0777);
    @chmod("photos/$cat/", 0777);
    $b = @mkdir("photos/$cat/$sku/", 0777);
    @chmod("photos/$cat/$sku/", 0777);

but why can't use recursive on mkdir?

like image 69
richardalberto Avatar answered May 25 '26 04:05

richardalberto



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!