Path for makeDirectory Hello!
I try to create a directory in my proyect.
$folder = 'promo_' . $id;
$path = base_path() . '/resources/promos/' . $folder;
Storage::makeDirectory($path, 0777, true);
But when I go to resources/promos/promo_1, there is nothing... :(
I can't create directory in these path?
In my app when an user create a promo, the controllore first have to create a Directory and next put in a few files (These files are views, js and css)
Thanks
Hello,
That should work, but what is Storage ?
What are permissions on resources folder ?
Hi @bestmomo ,
I saw Storage::makeDirectory here:
http://laravel.com/docs/5.1/filesystem#introduction
As permissions... perhaps it is...
If I change the path, removing base_url() and substring '/resources/' newPAth = 'promos/' + $folder, works, but it had created directory in storage/app/promos...
I guess that can server.
thanks!
If you use Storage the default path is "storage\app" (set in filesystems.php). Why dont you simply use Laravel FileSystem for local ?
In laravel 5.1 the alias is Storage or not?
use Storage;
If I try
use Fylesystem;
I retrieve a error.
For basic Laravel file system the syntax is :
use File;
Not work.
use File;
and next in function controller I use
File:makeDirectory($path, 0777,true);
But not work :(
File::makeDirectory($path, 0777, true);
I retrieve this error:
ErrorException in Filesystem.php line 337: mkdir(): Permission denied
Try next.
At very top under namespace write:
use File;
Then in your method use:
$folder = 'promo_' . $id;
$path = base_path('resources/promos/' . $folder . '/');
File::makeDirectory($path, 0777, true, true);
The base_path function takes an argument if you want to go further then this folder.
Worked for me with File, amazing that Storage returns TRUE, but it doesn't work.
Thanks
Please sign in or create an account to participate in this conversation.