Re: [PHP] Uploading Files Should I use MySQL or Server for storage?
- From: rich@xxxxxxxxxxxxx (Richard Davey)
- Date: Mon, 21 May 2007 02:24:32 +0100
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.
Cheers,
Rich
--
Zend Certified Engineer
http://www.corephp.co.uk
"Never trust a computer you can't throw out of a window"
.
- Follow-Ups:
- Re: [PHP] Uploading Files Should I use MySQL or Server for storage?
- From: "benc11@xxxxxxxxx"
- Re: [PHP] Uploading Files Should I use MySQL or Server for storage?
- References:
- Uploading Files Should I use MySQL or Server for storage?
- From: "benc11@xxxxxxxxx"
- Uploading Files Should I use MySQL or Server for storage?
- Prev by Date: Uploading Files Should I use MySQL or Server for storage?
- Next by Date: Re: [PHP] Uploading Files Should I use MySQL or Server for storage?
- Previous by thread: Uploading Files Should I use MySQL or Server for storage?
- Next by thread: Re: [PHP] Uploading Files Should I use MySQL or Server for storage?
- Index(es):
Relevant Pages
|