TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 02-10-2008, 06:46 PM   #1 (permalink)
The Addict
 
sarmenhb's Avatar
 
Join Date: Jan 2008
Location: los angeles
Posts: 309
Thanks: 44
sarmenhb is on a distinguished road
Default what kind of data can go into a mysql database?

can huge zip files or .img files go in?

or is it best to put things like images etc.
__________________
no signature set
sarmenhb is offline  
Reply With Quote
Old 02-10-2008, 07:34 PM   #2 (permalink)
The Addict
 
Join Date: Nov 2007
Posts: 264
Thanks: 2
TlcAndres is on a distinguished road
Default

anything can go into a mysql database if you use blob
TlcAndres is offline  
Reply With Quote
Old 02-10-2008, 07:46 PM   #3 (permalink)
The Addict
 
sarmenhb's Avatar
 
Join Date: Jan 2008
Location: los angeles
Posts: 309
Thanks: 44
sarmenhb is on a distinguished road
Default

do people usually insert files into their database or just trow it into a upload directory?
__________________
no signature set
sarmenhb is offline  
Reply With Quote
Old 02-10-2008, 08:07 PM   #4 (permalink)
The Addict
 
Join Date: Nov 2007
Posts: 264
Thanks: 2
TlcAndres is on a distinguished road
Default

Upload directory in tangent with databse to keep the the path to the files, megaupload does this.
TlcAndres is offline  
Reply With Quote
Old 02-10-2008, 08:27 PM   #5 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

Never store files in mysql, its not mysql's purpose. You store the files as files on your hard drive (where it belongs) and the links to them in the database if need requires.
__________________

Village Idiot is offline  
Reply With Quote
Old 02-10-2008, 08:35 PM   #6 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

If databases weren't meant to store binary data, why do we have the BLOB column type available? There are strong arguments for and against on both sides of the argument, though often the strongest side tends to be to store the files in the file system and make a reference to the file name and/or path using a simple VARCHAR column.
Salathe is offline  
Reply With Quote
Old 02-10-2008, 09:28 PM   #7 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

Databases store infinite amount of data.
And that data can be anything.

I think that vBulletin stores avatars in blob field types. :]
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 02-10-2008, 09:39 PM   #8 (permalink)
The Frequenter
 
ReSpawN's Avatar
 
Join Date: Nov 2007
Location: Netherlands
Posts: 460
Thanks: 49
ReSpawN is on a distinguished road
Default

I'm interested. How does vBulletin store that data? Is it the same if I open an .JPEG image with notepad?
__________________
"Life is a bitch, take that bitch on a ride"
Send a message via MSN to ReSpawN
ReSpawN is offline  
Reply With Quote
Old 02-10-2008, 09:41 PM   #9 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

Quote:
Originally Posted by ReSpawN View Post
I'm interested. How does vBulletin store that data? Is it the same if I open an .JPEG image with notepad?
blob :P Really, just get vbulletin some how ( no, don't warez it ), look it up yourself.
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 02-10-2008, 09:42 PM   #10 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

Quote:
Originally Posted by Orc View Post
Databases store infinite amount of data.
And that data can be anything.

I think that vBulletin stores avatars in blob field types. :]
Nope
http://www.talkphp.com/avatars/orc.gif
__________________

Village Idiot is offline  
Reply With Quote
Old 02-10-2008, 09:47 PM   #11 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

Quote:
Originally Posted by Village Idiot View Post
No no no, not that, theres a different method, by storing it in a php file.
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 02-10-2008, 09:48 PM   #12 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

Quote:
Originally Posted by Village Idiot View Post
No no no, not that, theres a different method, by storing it in a php file.

The files aren't duplicated or created from the original, cause I looked all over in vbulletin. I dunno, check the dump
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 02-10-2008, 10:42 PM   #13 (permalink)
Alan @ CIT
Member of the Month
The Frequenter
Member of the Month Top Contributor 
 
Alan @ CIT's Avatar
 
Join Date: Apr 2005
Location: South UK
Posts: 483
Thanks: 51
Alan @ CIT is on a distinguished road
Default

If I had 10,000 2k images/files, I'd probably store them in the DB. If I 1000 100k files, I'd probably put them on the filesystem.

As for the vBulletin thing, vB has support for storing attachments, sig pics, profile pics, avatars and thumbnails in the database using Blob columns.

Alan
Send a message via MSN to Alan @ CIT
Alan @ CIT is offline  
Reply With Quote
Old 02-10-2008, 10:44 PM   #14 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

Quote:
Originally Posted by Alan @ CIT View Post
If I had 10,000 2k images/files, I'd probably store them in the DB. If I 1000 100k files, I'd probably put them on the filesystem.

As for the vBulletin thing, vB has support for storing attachments, sig pics, profile pics, avatars and thumbnails in the database using Blob columns.

Alan
Thank you for clearing that up.
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
The Following User Says Thank You to Orc For This Useful Post:
sarmenhb (02-11-2008)
Old 02-11-2008, 12:15 AM   #15 (permalink)
The Addict
 
sarmenhb's Avatar
 
Join Date: Jan 2008
Location: los angeles
Posts: 309
Thanks: 44
sarmenhb is on a distinguished road
Default

interesting,

now can someone explain why type of php code inserts an image uploaded into the db


thanks


wow i have so much gas, the smell is strong
__________________
no signature set
sarmenhb is offline  
Reply With Quote
Old 02-11-2008, 01:18 AM   #16 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

Quote:
Originally Posted by sarmenhb View Post
interesting,

now can someone explain why type of php code inserts an image uploaded into the db


thanks


wow i have so much gas, the smell is strong
the below comment was not needed but umm, also, I've never tried inserting images, or anything into a blob field, just that I make it save the path in the database, and grab the image. thats about it.
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 02-11-2008, 01:28 AM   #17 (permalink)
The Addict
 
Join Date: Nov 2007
Posts: 264
Thanks: 2
TlcAndres is on a distinguished road
Default

Google turned up a quick example

Uploading Files To MySQL Database Using PHP

and Ork was right...the last comment wasn't needed.
TlcAndres is offline  
Reply With Quote
Old 02-23-2008, 12:08 PM   #18 (permalink)
The Wanderer
 
Join Date: Jan 2008
Posts: 21
Thanks: 0
Speeple is on a distinguished road
Default

One of the benefits of using a database system over the file system to store files is to overcome throughput issues.

Having directories of millions of files for example can kill IO throughput. Databases can overcome this because usually they use a single table space. Not to mention they have sophisticated data caching methods.

But do remember, a file system was designed to store files, so in the majority of cases it is advisable to use it.
__________________
AKA Martin Gallagher
Speeple is offline  
Reply With Quote
Old 02-23-2008, 01:21 PM   #19 (permalink)
The Frequenter
 
ReSpawN's Avatar
 
Join Date: Nov 2007
Location: Netherlands
Posts: 460
Thanks: 49
ReSpawN is on a distinguished road
Default

So the most likely conclusion is to store small types of binary data in the database, like documents and small images, but store files of great size, like say 100MB or maybe 1000MB (1GB) on the filesystem.
__________________
"Life is a bitch, take that bitch on a ride"
Send a message via MSN to ReSpawN
ReSpawN is offline  
Reply With Quote
Old 02-23-2008, 07:42 PM   #20 (permalink)
WebDev'n Beer Drnkn' Fool
 
stewart's Avatar
 
Join Date: Dec 2007
Location: Denver, CO
Posts: 59
Thanks: 2
stewart is on a distinguished road
Default

There is a significant amount of overhead when using the BLOB field type for storing much of anything last i knew :S
__________________
stewart::howe
Web Developer & Programmer
CelerMedia.Com | iAmStewart.com | CelerLabs.com
Send a message via ICQ to stewart Send a message via AIM to stewart Send a message via MSN to stewart Send a message via Yahoo to stewart
stewart is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 05:12 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design