Ad

What Should Be The Better Way To Store Images Or Files To Folder In Laravel Application

- 1 answer

I am doing a project using Laravel. Now, I have to store customers, users etc images both in the database and application folder. There are two ways to store images or files in laravel application.

  1. Inside public folder I can store.
  2. Another one is, inside storage/app/public

From these two ways, what should be better to do this. Would someone suggest me please? Thanks in advance.

Ad

Answer

There's not an enormous difference, but in general, it's better to put things in storage/app/public.

This allows you to give Laravel write permissions to the storage folder, while leaving its permissions on public as read-only. This is a bit more secure.

Ad
source: stackoverflow.com
Ad