MRustamzade
MRustamzade

Reputation: 1455

Storage::makeDirectory in public folder

I'm trying to create folder in public/storage but when i call Storage::makeDirectory("public/storage/newdirectory") it creats folder in storage folder with subfolders public/storage/newdirectory. when i try to change it to ../public/storage then i get error message "Path is outside of the defined root". Any idea how can i change it?

From internet found somethin like this: public_path("/storage/newdirectory"); and it doesn't helped.

Upvotes: 2

Views: 2798

Answers (2)

Cerlin
Cerlin

Reputation: 6722

By default laravel takes storage directory as root directory.

Change the root directoy info in filesystems.php

'local' => [
    'driver' => 'local',
    'root' => '/path/to/your/directory',
],

Upvotes: 0

Alexey Mezenin
Alexey Mezenin

Reputation: 163748

Do this:

File::makeDirectory(public_path('storage/newdirectory'));

Upvotes: 3

Related Questions