473,657 Members | 2,535 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Files into MySQL

Ok, I have been told that it's not a good idea to store binary files
(like pdfs etc.) in MySQL, but in the file system. I am in desperat
need of a system where I can upload binary files like this, categorize
them, add some extra info to each file, and list them/make them
downloadable. (listing and making files downloadable is easy with
PHP).
If I upload each file to a folder in the web server file system, how
is it then that I can refer extra information like a category and some
metadata to the files that I later will list? No database=no extra
info?
I need a human understandable answere, since I am a really newbie in
PHP and MySQL. Hopefully a code example. If someone could help.

Mar 26 '07 #1
35 1907
Message-ID: <11************ **********@d57g 2000hsg.googleg roups.comfrom
Nosferatum contained the following:
>If I upload each file to a folder in the web server file system, how
is it then that I can refer extra information like a category and some
metadata to the files that I later will list? No database=no extra
info?
I need a human understandable answere, since I am a really newbie in
PHP and MySQL. Hopefully a code example. If someone could help.
Well a database table would be best but you could store the information
as a csv file.

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Mar 26 '07 #2
Nosferatum wrote:
Ok, I have been told that it's not a good idea to store binary files
(like pdfs etc.) in MySQL, but in the file system. I am in desperat
need of a system where I can upload binary files like this, categorize
them, add some extra info to each file, and list them/make them
downloadable. (listing and making files downloadable is easy with
PHP).
If I upload each file to a folder in the web server file system, how
is it then that I can refer extra information like a category and some
metadata to the files that I later will list? No database=no extra
info?
I need a human understandable answere, since I am a really newbie in
PHP and MySQL. Hopefully a code example. If someone could help.

You should really be asking this in a MySQL newsgroup - such as
comp.database.m ysql.

But I will also add - how may of those people who say that have actually
tried? I suspect none. I have been doing it for almost 20 years and it
works fine.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Mar 26 '07 #3
Nosferatum wrote:
Ok, I have been told that it's not a good idea to store binary files
(like pdfs etc.) in MySQL, but in the file system. I am in desperat
need of a system where I can upload binary files like this, categorize
them, add some extra info to each file, and list them/make them
downloadable. (listing and making files downloadable is easy with
PHP).
If I upload each file to a folder in the web server file system, how
is it then that I can refer extra information like a category and some
metadata to the files that I later will list? No database=no extra
info?
I need a human understandable answere, since I am a really newbie in
PHP and MySQL. Hopefully a code example. If someone could help.
I'm certainly not the best coder here by miles but my suggestion is that
you create a table to store the information about the files and a filename
including path. You save the file to that path and use a SQL query to
extract the path name when you want to access the file. Up to you what you
use for file names. In my own photo database I am writing I use an auto
incrementing primary key as the file path for example, so the thumbnail for
photo_id=123456 lives at /data_dir/1/2/3/4/5/small.jpg. Someone will have
a better idea than this, but this one seems to work for low usage.

--
http://www.petezilla.co.uk
Mar 27 '07 #4
Jerry Stuckle wrote:
But I will also add - how may of those people who say that have actually
tried? I suspect none. I have been doing it for almost 20 years and it
works fine.
Files belong in the filesystem. It's what it does.

Data belongs in the database. It's what it does.

There, done it: that should stoke the fires of debate.

--
"Checking identity papers is a complete waste of time. If anyone can
be counted on to have valid papers, it will be the terrorists".
Mar 27 '07 #5
Peter Chant wrote:
photo_id=123456 lives at /data_dir/1/2/3/4/5/small.jpg.
Stick it in /data_dir/123456/small.jpg.

--
"Checking identity papers is a complete waste of time. If anyone can
be counted on to have valid papers, it will be the terrorists".
Mar 27 '07 #6
Nosferatum wrote:
If I upload each file to a folder in the web server file system, how
is it then that I can refer extra information like a category and some
metadata to the files that I later will list? No database=no extra
info?
Store the metadata in a table; use the id as the directory name for the
files: /data_dir/$id/ contains the file.

--
"Checking identity papers is a complete waste of time. If anyone can
be counted on to have valid papers, it will be the terrorists".
Mar 27 '07 #7
Mary Pegg wrote:
Jerry Stuckle wrote:
>But I will also add - how may of those people who say that have actually
tried? I suspect none. I have been doing it for almost 20 years and it
works fine.

Files belong in the filesystem. It's what it does.

Data belongs in the database. It's what it does.

There, done it: that should stoke the fires of debate.
Sorry, I don't bite on trolling expeditions. If you want to discuss it,
take it to comp.database.m ysql.

Or try it yourself.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Mar 27 '07 #8
Mary Pegg wrote:
Nosferatum wrote:
>If I upload each file to a folder in the web server file system, how
is it then that I can refer extra information like a category and some
metadata to the files that I later will list? No database=no extra
info?

Store the metadata in a table; use the id as the directory name for the
files: /data_dir/$id/ contains the file.
Spoken by someone who obviously has no idea what they are talking about.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Mar 27 '07 #9
Jerry Stuckle wrote:
Mary Pegg wrote:
>Nosferatum wrote:
>>If I upload each file to a folder in the web server file system, how
is it then that I can refer extra information like a category and some
metadata to the files that I later will list? No database=no extra
info?

Store the metadata in a table; use the id as the directory name for the
files: /data_dir/$id/ contains the file.

Spoken by someone who obviously has no idea what they are talking about.
Because files obviously belong in the database?

--
"Checking identity papers is a complete waste of time. If anyone can
be counted on to have valid papers, it will be the terrorists".
Mar 27 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1463
by: Prem Soman | last post by:
--0-416482240-1060749044=:93966 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Content-Id: Content-Disposition: inline Note: forwarded message attached. ________________________________________________________________________ Want to chat instantly with your online friends? Get the FREE Yahoo!
0
2748
by: Bennett Haselton | last post by:
I'm trying to port my MySQL tables for a database called "tracerlock" from one server to another. On the old server, in the /var/lib/mysql/tracerlock directory, there was a ".MYD", ".MYI" and ".frm" file for every table in the database. So after creating a database called "tracerlock" on the new server, I copied these files over to the /var/lib/mysql/tracerlock directory on the new server. On both servers, all the table files are owned...
0
1300
by: Missaka Wijekoon | last post by:
Folks, I have 3 mysql replicated servers ( 1 master + 2 slaves). One thing I noticed is that every once in a while the data (*.MYD) and index (*.MYI) files for a table may differ from the other mysql servers. Now my question is this: If I have identical data files on each server (verified by using checksums), should the indexes generated be identical on each mysql server? If not, is there something wrong? Is it possible for mysql...
10
8972
by: MLH | last post by:
I have a database named credifree. I did it with mysql's create command. Yet, I can find no files on my linux box except for a\ directory and a gif file that have the name credifree. Why? What's the name mysql might have made a database file under? Where is it stored? Just curious. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx mlh@appserver mlh $ mysql / -u root -p
4
2799
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 http://192.168.1.106/~mlh/credifree/index.php the AMP app still thinks the data resides somewhere else. It runs fine - as long as I leave my LAN's external internet connection up. But if I unplug my LAN from the world, my app locks up. Before I...
2
3893
by: Carlos Eduardo Peralta | last post by:
Hello: Can i update a MySQL database with just copy the files MYI MYD and FRM in the right dir? I know this work. The question is how MySQL manage the user that are usig that database in that moment. Can i close all the connection to that database? How can i tell MySQL deamon that don´t use that database any more? Thank you in advance.
4
1778
by: himilecyclist | last post by:
After running my PHP/MySQL application, I have found that the associated .MYD and .MYI files remain locked. Even after the browser is closed, if I try to rename these files, I get the message: Can't rename filename. It is being used by another person or program... These files remain locked until I reboot. I'm running on a Windows XP machine.
1
2322
by: Israel | last post by:
I'll preface this by saying that my preference is to dump a database to SQL and transfer that file around but this is not the situation that I'm in and I'll probably be in this situation in future.. I have all of the files from under C:\Program Files\MySQL\MySQL Server 4.1\data that were copied from another machine while mysqld-nt.exe was still running. I thought that maybe I could copy these files over to my machine, after first...
17
2574
by: b007uk | last post by:
Hi all, I really need your advice. I have to store over a million files, 10 - 15 kb each, in one folder. The files are created by my php script, sometimes the old files are deleted and new ones are written. So, basically on every connection my script reads/deletes/ writes files from/to that folder. Right now i have only around 300 000 files in that folder, and it feels like its getting slower for that script to work. It does work at the...
221
367391
Atli
by: Atli | last post by:
You may be wondering why you would want to put your files “into” the database, rather than just onto the file-system. Well, most of the time, you wouldn’t. In situations where your PHP application needs to store entire files, the preferred method is to save the file onto the server’s file-system, and store the physical location of the file in your database. This is generally considered to be the easiest and fastest way to store files. ...
0
8305
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8726
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8603
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7320
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6163
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1944
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.