Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jan01's avatar
Level 1

Changing path of storage folder for Storage Facade not working (anymore).

I am currently trying to find a way to change laravels storage path (for the whole storage folder) to a custom one (e.g. /my/custom/storage_folder). The first way (using AppServiceProvider) seems to have worked in the past (according to other online posts), but is not fully working anymore.

1. Using AppServiceProvider (Not working)

When tyring to change the apps storage path in the AppServiceProvider register method with the following code:
public function register() {
$this->app->useStoragePath(config('filesystems.storage_path'));
}

the following happens:

  • The storage_path() returns the right path: e.g. /my/custom/storage_path
  • When using the Storage Facade, laravel uses the default path: /var/www/mywebsite/storage => Also results in logs/compiled views being saved in the standard folder

Using this way,

Storage::disk('local')->getAdapter()->getPathPrefix();

returns " /var/www/mywebsite/storage". (The disks root is set to storage_path() in the filesystems config file.)

2. Using bootstrap/app.php (Working, but unresponsive)

When using the following code in the bootstrap/app.php:
$app->useStoragePath("/my/custom/storage_folder");

laravel uses the right storage path for everything, but this way is not very nice, because it is not possible to get the storage path from one of the config files/the environment file.

Does anyone know a solution? Thankful for all help!

0 likes
3 replies
jlrdw's avatar

You can store anywhere as long as the folder has proper permissions, I use a folder called

 laravel58\assets\upload
jan01's avatar
Level 1

I would like to move the whole storage folder. I know i can specify a folder when saving something with the Storage Facade, but I would like to set the default path, so logs and compiled views also get safed in my custom one.

jlrdw's avatar

I wouldn't mess with the storage for logs, etc. I was referring to an image upload, sorry.

Please or to participate in this conversation.