Hello all,
I would like to store a binary file (for example
a GIF file) in a MySQL database (BLOB field).
How can I get a file in MySQL with PHP and
how can I get it out again without altering
the file?
Any help is greatly appreciated.
Printable View
Hello all,
I would like to store a binary file (for example
a GIF file) in a MySQL database (BLOB field).
How can I get a file in MySQL with PHP and
how can I get it out again without altering
the file?
Any help is greatly appreciated.
personally I would store the image in a directory and then the path in mysql.
let me check on this as I have never done it. I would think it is the same as anything else, but let me check
I have seen a tutorial on how to do this somewhere before, but I can't seem to find it now. I'll keep looking.
However, I do agree with scoutt that I'd put it in a directory somewhere and then possibly store the location of it in a database instead.
Thank you both (scoutt and The Hobo) for the
reactions, however I found two articles on
www.phpbuilder.com which explained how to
use the blob field.
Scoutt, about your remark about storing just the
path to the image in a database, you might be
right. However, the GIF was just a sample. More
likely I will store other types of files in my DB,
files that may not be linked to directly from other
sites and so.
Anyway, thanks again.
I was just going to say that there is tutorials on phpbuilder to look at. although my suggestion was just that, a suggestion, you have to make the choice. but I will say that when you start ading pictures or other stuff in the blob field, you database will be getting big fast. jsut a side note if you interested.