473,385 Members | 1,506 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,385 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 3635
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.