dimanche 22 novembre 2015

laravel mkdir() Permission denied

I try the following method to create a folder with it's subdirectorys if it does not already exists:

public function createFolderIfNotExist($path){
    //Check if the folder already exists
    if(!File::Exists($path)){
        //make folder with $path generate recursive with right 0775
        File::makeDirectory($path, 0775 , true);
    }
}

When running localy it works fine (xampp), when pushed to the server it returns

permission denied

First lines of the error

in Filesystem.php line 337

at HandleExceptions->handleError('2', 'mkdir(): Permission denied', '/var/www/****/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php', '337', array('path' => '/var/www/****/public/images\product\206', 'mode' => '509', 'recursive' => true, 'force' => false))

at mkdir('/var/www/****/public/images\product\206', '509', true) in Filesystem.php line 337

at Filesystem->makeDirectory('/var/www/****/public/images\product\206', '509', true) in Facade.php line 216

at Facade::__callStatic('makeDirectory', array('/var/www/****/public/images\product\206', '509', true)) in ProductController.php line 452

The error message makes it look like im trying to set the permissions to 509

The path that I pass is:

$pathThumb = public_path('images\product\\'.$product->id.'\thumb');

What am I doing wrong?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire