I am building a web store. I want to know should I store the item images in the mysql database or in the server file? which one is better? I know blob has a limit. There will be 1000s of item to post with images.
Store image in mysql or server? which one is better?
It's always made more sense to me to leave the files on the file system.
bradgrafelman;11008527 wrote:It's always made more sense to me to leave the files on the file system.
will image file more difficult to manage on server because in mysql, the image files have all the reference together in one table.
You can still store the file URLs and/or path to the files in the database.
Generally the best idea is to store the file on the file system and data about the file in the database. Its very simple and will help keep your app faster. If you start storing hundreds, thousands or even millions of images in a table instead of just the data about the image, then your table will become very large and reads will begin slowing down considerably.
Thank you guys for the suggestion. Right now, I do both, which store images in server and mysql, and I am consider removing mysql image stored in future.
Do you guys rename those files during upload to the file server?
It helps to avoid duplicate filenames, and files with nasty names that could make the filesystem cry.