Laravel - Get storage disk path
Stefan Izdrail
Founder & Senior Architect · 2026-06-29
Title: Understanding and Retrieving Storage Disk Paths in Laravel
Laravel provides a powerful file system abstraction layer through its storage classes to handle various storage scenarios efficiently. Utilizing disk interfaces allows developers to store, retrieve, and manage files based on their specific needs. In this blog post, we will explore how to get the path of an existing storage disk in Laravel so that you can utilize it in different scenarios like the one presented above.
Before delving into the process, let us first understand some key terms and concepts:
1. Storage Interfaces - These represent file systems within Laravel apps. Some common interfaces include 'local', 'public', 'private', 'cloud' and custom ones that you can create for specific needs. You can use these interfaces to access files with methods like `Storage::disk('interface')->get(...)` and `Storage::disk('interface')->put(...)`.
2. Storage Disk Path - This is the actual location where files are stored in the file system, determined by the storage interface and local configuration settings. Knowing this path allows you to manually access or manipulate files outside of Laravel's abstraction layer.
Now let us dive into how to obtain a storage disk path:
1. Get the Name of the Disk Interface - First, determine which disk interface you want to get the path for using the `Storage::disk()` method. This method takes a string argument representing the name of your desired interface and returns an instance of the corresponding disk class, such as 'uploads' in our example scenario.
$disk = Storage::disk('uploads');
2. Retrieve the Disk's Path - Once you have a reference to your storage interface, you can call its `getPath()` method to get the absolute path of that disk's directory on your file system:
$path = $disk->getPath();
3. Access and Manipulate Files - With the disk's actual path in hand, you can now perform various operations like storing uploaded files, resizing or manipulating images, as shown in your example:
$icon = $request->file('icon')->store('icons', 'uploads');
Image::make(Storage::disk('uploads')->path($icon))->resize(...)->save();
In this case, the file is first uploaded to your storage interface (`'uploads'`) by calling `store()`, and then you access its path using the provided method. You can use this path for further manipulation or custom operations outside of Laravel's abstraction layer if needed.
In conclusion, getting the storage disk path in Laravel allows you to perform file management tasks that are not directly supported by its abstraction layer. While it is possible to achieve most requirements using built-in methods, understanding how to obtain and use this path provides additional flexibility for complex scenarios. By following these steps and incorporating best practices, you can efficiently manage your files in Laravel applications while maintaining a high level of control over your storage infrastructure.