Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how and where can store images with laravel?

Tags:

how and where I can store images using laravel?

context: I want display some images in my main view (these are predefined by me). I also want to store images uploaded by users, however, do not know where to store these images.

I'd like to call these from the view...

Thank you very much for the help. :)

like image 407
Reco Jhonatan Avatar asked Jul 07 '16 22:07

Reco Jhonatan


People also ask

How do I move images to storage in Laravel?

Show activity on this post. $files = Storage::files('public/images/'. $dir->name); foreach($files as $file){ Storage::move($file, 'public/images'); } Storage::deleteDirectory('public/images/'. $dir->name); $dir->delete();

What is storage path in Laravel?

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


1 Answers

Basically you can save your files wherever you want within your Laravel application provided that you have permissions to create directory and file.

But I prefer saving files in the storage/app folder. Laravel provides a simple API to manipulate files on disk. See the docs.


Update:

This answer was posted when Laravel was in version 5.2. From version 5.3 on, you can easily create symbolic links by running the artisan command php artisan storage:link. See the docs.

like image 153
Carter Avatar answered Oct 03 '22 05:10

Carter