Laravel storage path from config file

laravel download file from storage
laravel download file from url to storage
laravel upload file
laravel file exists
laravel absolute file path
get absolute file path laravel
laravel upload file to storage
laravel get all files in directory

I am working on a project in which I see that images are being saved in this way

$file_name = $input['image']->store(config('app.files.user_images.folder_name'));

Can anyone tell me what's the purpose of config function and it's parameters?

The file system configuration file is located at config/filesystems.php. Within this file, you may configure all of your "disks". Each disk represents a particular storage driver and storage location.

config('app.files.user_images.folder_name')

Note: it returns folder or file path.

https://laravel.com/docs/5.7/filesystem

File Storage - Laravel, The filesystem configuration file is located at config/filesystems.php . Within this file you By default, this value is set to the storage/app directory. Therefore, the  {note} Unprintable and invalid unicode characters will automatically be removed from file paths. Therefore, you may wish to sanitize your file paths before passing them to Laravel's file storage methods. File paths are normalized using the League\Flysystem\Util::normalizePath method. Specifying A Disk. By default, this method will use your default disk.

Take a look to Create custom config file in laravel 5.

The config files contain a list of key/value that you can call everywhere in your project.

And the method you see in your project is just a way of managing/structure your app, using config file to define "key/value" list will give you the ability to change the value of any key ("folder_name" in your example) inside the file, and the value will be changed in all the places you're calling the config entry with this key.

Example :

If your config file contains [ 'folder_name' => 'X' ] and you're using config('app.files.user_images.folder_name') in several controllers, the day you want to change the folder name to Y in all those controllers you've just to change it in one place (inside the file [ 'folder_name' => 'Y' ]) instead on traversing all the controllers searching for the folder name and replace it.

Filesystem / Cloud Storage - Laravel, All of the configuration files for the Laravel framework are stored in the config directory. Each option is documented, so feel free to look through the files and get​  In config/filesystems.php you can see the disks local and public defined. By default, Laravel uses the local disk configuration. The major difference between local and public disk is that local is private and cannot be accessed from the browser while public can be accessed from the browser.

first of all you should use this command in terminal project directory

php artisan storage:link

after you should use this line in you

$request->file('FileName')->store("Public Folder Path hare")

it will work fine

Configuration - Laravel, I will use the local driver, whose methods are relative to the root directory defined in the configuration file config/filesystem.php . By default, this  If you think you need the local path to build an url to the file, use the Storage::url() method. If you need the path to the file for some external processing; download it using Storage::get(), do the processing, and then upload the file again.

Get the full path of a File using the Storage facade on Laravel – Yet , Its not working, im still getting path without 'app' folder. I have clear the config cache by commands: php artisan cache:clear php artisan config:  The config_path function returns the fully qualified path to the config directory. You may also use the config_path function to generate a fully qualified path to a given file within the application's configuration directory:

Get local file path with Storage · Issue #13610 · laravel/framework , By default, uploaded files and photos are stored in public disk of Laravel settings, which is storage/app/public folder, see configuration file config/filesystem.php: All of the configuration files for the Laravel framework are stored in the config directory. Each option is documented, so feel free to look through the files and get familiar with the options available to you. Environment Configuration. It is often helpful to have different configuration values based on the environment where the application is running.

Settings: How to Change Location of Where Files Are Stored , The filesystem configuration file is located at config/filesystems.php . This convention will keep your publicly accessible files in one directory that can be easily  The way Storage::disk('local')->url('filename.png') actually returns the path to the file, but it lacks the folder that was listed in the "/config/filesystem.php": eg "app" folder: I tried to solve this problem - and as a result wrote this method.

Comments
  • downvoting for no reason. If you know the answer then answer here rather than downvoting.
  • You're likely being downvoted because that information could've been easily found in the Laravel documentation and it looks like you made no attempt to find it on your own.
  • That's not quite an answer to the question "what's the purpose of config function and it's parameters"