Hi benc11,

Monday, May 21, 2007, 2:16:19 AM, you wrote:

> I am in the process of adding a part to my website which would include
> pictures, pdf files, txt files, and excel files.  The files sizes
> could be anywhere on average of 100k to 2mb.  Do you think I should be
> uploading the files to a MySQL database or to my server?

> I have head that there are pros and cons to both, but have never
> really received a definitive answer that helps much.  I appreciate all
> your opinions on the pros and cons of both.

This isn't a 'one size fits all' question. The pros and cons are
specific only to your site. How many uploads are you going to be
dealing with, at what frequency, at what growth rate? Are they going
to be massively downloaded too?

There generally are far less 'pros' for storing binary files in MySQL
than you'd think. The only real benefit imho is that they are then
filesystem / platform agnostic.

There are plenty of 'cons' however. Just think of the server overhead
involved in your PHP script talking to MySQL, MySQL sending back the
entire file to PHP (using memory / cpu bandwidth), then you've got to
blast that file out to the end user. Repeat this X however much
traffic you get and you're performing pointless exercises over and
over when the web server could just serve the file directly.

Only you can answer your question really.


Zend Certified Engineer

"Never trust a computer you can't throw out of a window"

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to