RE: [PHP] php, text file, and mysql
| From: | Jason Murray | Date: | Thu, 07 Mar 2002 23:15:36 +0000 |
| Subject: | RE: [PHP] php, text file, and mysql | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-87708@lists.php.net to get a copy of this message | ||
> But for storing images and PDFs or other binary data, there's
> no other way.
Actually, after having some problems with BLOB columns when
mysqldump'ing and moving the data into a new database, I did
find another way. I borrowed a trick from MIME mail handling,
and base64_encod'ed, then chunk_split'ed the data. This makes
it very text-field friendly.
> Note that many MySQL wizards will recommend that instead of
> storing binary data in a database, use a filesystem to store
> the data and then use the database to create a sort of
> "directory" for quickly locating those files in the filesystem,
There's a problem with this, it assumes that you only use one
filesystem for your site. In the case of Melbourne IT / INWW,
we have 5 or 6 web servers that load balance. If a user uploads
data and we copy it to the filesystem, then it's only available
on 1 web server. This is why we put it in the database. :)
Jason
--
Jason Murray
jasonm@melbourneit.com.au
Web Developer, Melbourne IT
"Work now, freak later!"