467,145 Members | 987 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,145 developers. It's quick & easy.

mySQL & Files

Hi,

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.

Any examples would be most appreciated. I am using RH9 and the latest
version of mySQL.

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.

TIA

A
Jul 19 '05 #1
  • viewed: 3423
Share:
2 Replies
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

Jul 19 '05 #2
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

Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by iwasinnihon | last post: by
reply views Thread by Fan of P2P | last post: by
1 post views Thread by res1fowk | last post: by
1 post views Thread by ktosiek | last post: by
3 posts views Thread by eieiohh@hotmail.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.