Possible Duplicate:
User images - database vs. filesystem storage
Hello ! Where should i store photos for a facebook-like app ? locally on the server in a folder or upload them to a database ? I am not intending to make this app commercial .
Possible Duplicate:
User images - database vs. filesystem storage
Hello ! Where should i store photos for a facebook-like app ? locally on the server in a folder or upload them to a database ? I am not intending to make this app commercial .
Store images in file system(folders) and store path in database.
EDIT:
Found an interesting article about How Facebook handle image storage:
Facebook: Needle in a Haystack: Efficient Storage of Billions of Photos
Some facts from above article:
I would prefer files to be stored in file-system and data to be stored in database. So, what I will do is I will upload the file and save it in file system.. in a directory. Say, /home/username/appfiles/ and in data base I will have a reference to it. Say, under column image_location: /home/username/appfiles/image_file_name.
What I will also do is I will rename the file by appending a timestamp to make sure two files with same name does not get over-written.