473,399 Members | 4,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

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
2 3636
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: iwasinnihon | last post by:
I don't usually like to do this, but I need help. I have gone over this code and cannot figure out why it doesn't work. First of all it doesn't check to see if you have filled in the required...
0
by: Fan of P2P | last post by:
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...
1
by: res1fowk | last post by:
I am using mysql 5, php 5, and apache 2. I can get php and apache working together. Mysql works by itself. From the manual... I cannot figure out how to activate Mysqli. I have placed the...
4
by: MLH | last post by:
A programmer developed an AMP (Apache/MySQL/PHP) application for me. When he was done, he sent me the PHP files and the MySQL dump file. Now, when I connect to the application on my LAN using...
1
by: ktosiek | last post by:
hello how to upload files to mysql database thanks for help
1
by: jlee | last post by:
I'm pretty much a newbie on mysql, and I need some help. I am running mysql Ver 12.22 Distrib 4.0.24, for portbld-freebsd5.4 (i386) on a server hosting an active website. The site's developer...
3
by: eieiohh | last post by:
MySQL 3.23.49 PHP 4.3.8 Apache 2.0.51 Hi All! Newbie.. I had a CRM Open Source application installed and running. Windows Xp crashed. I was able to copy the contents of the entire hard...
3
by: jonathan184 | last post by:
The code seems to be working fine for some records but I am thinking it is finding some other records with special characters and so on. I am looking for a way to insert the xml string with escaping...
1
by: chennaibala | last post by:
can any one send me mutiple image upload program and save the file name with extension in mysql table.we must cheak uploaded file type like bmp or any image file while uploading. i develop...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.