|
Posted by faulkes on 01/08/08 21:11
On Jan 8, 11:56 am, missmoo <mor...@gmail.com> wrote:
> I would like to know what the differences are in terms of security,
> reliability and resources between storing user-uploaded images in a
> file or storing them in a mySQL database.
Few, as has been pointed out, the less secure (IMO) being handling
files to disk, although any number of ways to mitigate that.
> Our company is starting an image-competition soon, and I am not sure
> if I should write the php script to insert the binary code into a
> mySQL database or if I should just store the files in a dedicated
> folder and the data about them in the mySQL database.
What is the intended end use? security & reliability both have
intended consequences (well, benefits). If reliability is the
more important of the two you have to consider what happens if
the system housing the images in the db grows too large to deal
with? what if the db dies and needs to be restored? how much
downtime is acceptable? Are you doing any sort of replication?
> We are expecting relatively big loads of files, at least 10,000 in the
> first 2 months.
>
> Which system should I use? Is there a real difference between the two?
> our server is apache2, if that has any effects on the answer..
How big do you expect each image to be? how often do you expect each
image to be viewed? All important questions you need to ask before
saying the db or the fs is the best place to store the image.
Based on what you have stated, that there will be an expected 10k of
images, I would say you want to go with the filesystem, with an
appropriate
directory split-up (so you aren't dumping 100k files into one
directory).
[Back to original message]
|