Laravel 5 - File::makedirectory
NickName:Mads Grevit Ask DateTime:2016-08-05T01:20:15

Laravel 5 - File::makedirectory

I simple just can't get this to work in Laravel 5. and furthermore Laravel doesn't give me any errors to work with. I have build a small CMS system where users are allowed to create a gallery page. When the gallery page is created it should create a folder for the user as well.

$path = public_path('/userfiles/3/Galleri/1');

File::makeDirectory($path, 0777, true);

I'm trying this, and tried different other approaches. I'm working in Laravel 5 and on a shared host, if that has anything to do with it.

Copyright Notice:Content Author:「Mads Grevit」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/38773715/laravel-5-filemakedirectory

Answers
jonju 2016-08-04T17:39:32

This works perfectly fine for me. Give it a try\n\nuse File;\n$path = public_path('/userfiles/3/Galleri/1');\nFile::makeDirectory($path, 0777, true);\n\n\nOR\n\n$path = public_path('/userfiles/3/Galleri/1');\n\\File::makeDirectory($path, 0777, true);\n",


More about “Laravel 5 - File::makedirectory” related questions

Laravel 5 - File::makedirectory

I simple just can't get this to work in Laravel 5. and furthermore Laravel doesn't give me any errors to work with. I have build a small CMS system where users are allowed to create a gallery page....

Show Detail

Laravel 5.2 Storage::makeDirectory($dir) is not creating directory

I am getting confused with this logic. I am using Laravel 5.2 Storage::makeDirectory to create two paths, first (video/) is created correctly and the other (thumbnails/) don't. $user = 1; if(!File::

Show Detail

File makeDirectory

I can make a Folder Successfully when a user create his account based on his chosen username but I also want to instruct make sub folders for instance when you create an account with username &quot...

Show Detail

Laravel 5: mkdir/Filesystem::makeDirectory with permissions from config

I'm running into an issue this morning with FileSystem::makeDirectory which directly calls mkdir. I'm trying to create a directory recursively pulling the desired mode out of my config like so: $

Show Detail

After using File::makeDirectory in Laravel, I get "mkdir(): No such file or directory" error

I'm trying to create a folder that will contain all images of an image album. Unfortunately, when I try to use File::makeDirectory I get the "mkdir(): No such file or directory" error. Now, I am ei...

Show Detail

Laravel 5 global variable in views

I created a GlobalComposer class to get the username in all Views: <?php namespace App\Http\ViewComposers; use Illuminate\Contracts\View\View; use Illuminate\Support\Facades\Auth; class

Show Detail

Laravel 5 storage permission

How can we set folder permission when we create make directory using Laravel 5 storage? Storage::makeDirectory($encrypt);

Show Detail

Using Storage::makeDirectory() not creating a folder in laravel

I'm trying to save a folder to the storage folder, but it isn't creating the folder. What happens is that, I save the folder name in a form and what I want to happen is that if that folder doesn't ...

Show Detail

Laravel 5 Intervention create directory uploading image - NotWritableException

I am trying to upload and resize an image in Laravel 5 and the Intervention library. My code in the Controller is this: // Upload img if ($req->hasFile('img')) { // Original ...

Show Detail

Laravel 5 storage

I have tried to upload an image file in a sub-folder but I didn't get the help from internet. In Laravel website they mentioned about create folder but not explaining about sub-folders. My purpose ...

Show Detail