2 years ago

When to save URL images in a database vs when the file-system is enough

Posted 2 years ago by fsdolphin


What is the best way to manage images in the following situation…

I have a real simple CMS-like- app where images will be uploaded and stored in either the default storage or the public directory (not sure what is the best location) and then accessed in any part of the authenticated areas of the app. For instance the user will have the option to insert any of the uploaded images from/to any of the pages by inserting the URL of the selected image (using an inline HTML editor ).

  1. Do I need to save the URLs of the images in a database or saving them in a directory and then just retrieving the file names directly from the directory would be enough?

  2. Can someone describe a situation when It’s recommended to use a database and when to use the file system directly?

Thanks a lot

Please sign in or create an account to participate in this conversation.