Page 1 of 1

Store a file in a database

Posted: Mon May 24, 2004 5:16 am
by Lord Sauron
Hi there,

Can someone please tell me, what type a database attribute should be of, when I'm trying to store a file in database. And what default value it should have.

Can I use the same type for any kind of file, or is maybe a different type necessary for .zip or .exe file?

Thanks in advance for the answer,

Antonie

Posted: Mon May 24, 2004 8:12 am
by feyd
meet MEDIUMBLOB, and it's siblings, LONGBLOB and BLOB

Not only for images

Posted: Mon May 24, 2004 8:47 am
by Lord Sauron
I though blob was only used for storing images, but I guess I was wrong ;-)

Okay, thanks.

By the way, when do you use longblob, mediumblob and blob? I there a certain size of the attachment required?

And I guess default value should be null?

Posted: Mon May 24, 2004 8:53 am
by feyd
the blob brothers are for binary data.. so yeah..
longblob has a maximum length of 4GB, mediumblob 16MB, blob 64K, and tinyblob 255 bytes.