Fan of P2P wrote:
Does anyone know how I can store files (mostly pictures) into a mySQL
table? I have tried the load_file function but it seems to not work.
i just get NULL as the value.
I use a MEDIUMBLOB column for storing JPEG files all the time. It works
fine for web-ish stuff. If you're storing MRI images or professional
quality photographs, it might be too small.
Any examples would be most appreciated. I am using RH9 and the latest
version of mySQL.
Examples in WHAT!?! Perl? PHP? ASP? ODBC? Java? JDBC? VisualBasic? C?
C++? COBOL.NET? (Sorry, but no one on this list seems to realize that
MySQL can be accessed in a zillion different ways.)
I'd be happy to provide a PHP example for storing and retrieving JPEG
files via the web - it will even create thumbnails. Let me know if that
would be helpful.
I know I should be storing the links on disk and the save a pointer in
the table but I want to put the files actually in the database.
Why "should" you store a pointer? You lose referential integrity and
create a backup/restore/changing servers/filesystems nightmare. I would
say you "should" store the data in the database.
- Mark