|
|
 |
Re: FN-FORUM: Storing images and other binary data in mySQL
date posted 27th April 2008 17:30
Yes in short. I've done it on one site - just to see how to do it
really :) I like it, as you can more easily maintain the documents as
and when you delete a record; instead of having to then delete files
too, with added security issues.
However, I only did it once and have stuck with the usual of storing
files in a separate place and doing deletes of files when deleting db
records.
http://highsierracld.co.uk does it - all the photos the client uploads
are stored and displayed from the db.
I did originally notice though, that the browser didn't seem to cache
images unlike with separate files. So navigating back a page required
images to be downloaded again. The site has been there around 4 years
now and I'm pretty sure images are now cached - unless broadband hides
that problem?
Rob Colton wrote:
> Splendid.
>
> Thanks for that I will follow your advice I think.
>
> R
>
>
> On 27/4/08 17:22, "Alex Townsend" [EMAIL REMOVED] wrote:
>
>> Rob Colton wrote:
>>> Hi
>>>
>>> Is it possible to store images and other binary data into fields in MySQL?
>>> Mostly I just want to save images but small video clips and audio might be
>>> nice too. (I guess it makes no odds what the content is)
>>>
>>> Have a lovely rest of weekend
>>>
>>> Rob
>>>
>> Yes, it's certainly possible to do - you need to use BLOBs (Binary Large
>> OBjects) to do it. The MySQL Documentation has more about BLOBs here (
>> http://dev.mysql.com/doc/refman/5.1/en/blob.html )
>>
>> Personally, I'd never recommend storing files inside MySQL though -
>> you're far better off storing the file in a file system, and holding a
>> pointer to it (usually the filename, to make things easier) in the DB.
>> That way is a lot safer, and less prone to corruption (and to filling a
>> DB with BLOBs) than storing the files themselves inside the database.
>>
>> Alex
>> http://www.ozbon.com
>>
>>
>
--
Dominic Raywood
Rubicon Computer Services Limited
W: http://rubiconcsl.com
E: [EMAIL REMOVED]
T: 08456 521 561 (+44 1823 698420)
F: 08456 521 561
M: 07050 204998 (+44 7811 252573)
Skype: RubiconCSL
|
 |
|