databasewebfrontendbackendpersistent-storage

Where should I store images in my web app?


I'm creating a web app that needs to display a slideshow of images on the homepage - the images will be updated every few weeks. Where should I store these images? On the frontend? On the backend? Or, should I host a DB and store them on there? Not sure what the pros and cons of each option are.


Solution

  • Typically, you'll store images for your website in a directory called "imgs" underneath your root htdocs or public directory. This is considered the front end; you don't really store images in a backend or DB unless you're storing links to those images and providing those links via an API call.

    If you wind up with lots of images, it's common to create more folders under that "imgs" directory, say one for each page or for one for each feature, but that's usually where images are kept.