When you upload a file in Laravel using the Storage facade, the location where the file is stored depends on the filesystem disk you are using. The default disk is set in your config/filesystems.php file, and you can retrieve it with:
self::$app['config']->get('filesystems.default')
If you use:
$path = Storage::putFileAs(MapFiles::UPLOAD_FOLDER_DEFAULT, $request->file, $fileName);
The $path variable will contain the relative path to the file within the disk you are using. For example, if your default disk is local, the file will be stored in the storage/app directory by default.
How to get the full path
If you want to get the absolute path to the file, you can use:
$absolutePath = Storage::path($path);
This will give you the full path on the server.
Example
Suppose your default disk is local and you upload a file:
$path = Storage::putFileAs('uploads', $request->file('file'), 'example.txt');
$pathwill be:uploads/example.txt- The actual file will be stored at:
storage/app/uploads/example.txt - To get the full path:
$absolutePath = Storage::path($path);
// Result: /full/path/to/your/project/storage/app/uploads/example.txt
If you are using the public disk, the file will be stored in storage/app/public, and you can access it via a URL if you have run php artisan storage:link.
Summary
- Relative path: Returned by
Storage::putFileAs() - Absolute path: Use
Storage::path($path) - Physical location: Depends on the disk (
local=storage/app,public=storage/app/public, etc.)
Let me know if you need more details on a specific disk or setup!