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 07-11-2010, 03:03 PM   #1 (permalink)
The Contributor
 
pipesportugal's Avatar
 
Join Date: May 2008
Location: Oporto-Portugal
Posts: 32
Thanks: 11
pipesportugal is on a distinguished road
Default save a PDF file inside a mySQL table

Hello dear colleagues,

I have been asked to test an application for Documentation Management, I am not sure on which language has been developped, but it was storing the data in a mySQL database on a Linux server.

Everytime I was saving a PDF/DOC,etc, I could see the size of the mySQL database growing up.So this application is storing these entire files inside a mySQL table.

Can anyone explain how this can be done from a php program, or how should the column be defined on the mySQL table.

Thanks in advance for all the help,
PP
pipesportugal is offline  
Reply With Quote
Old 07-11-2010, 09:54 PM   #2 (permalink)
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

The short answer is don't do this. Binary files can be saved directly in the database, but there's never been a good reason to purposely bloat your database like this and slow down operations performed on the table.

Store them in the filesystem, which was built for storing files. A well built application shouldn't even need to store the path in the database, but at the very most this is all you should be storing (the path/location of the file associated with the table row).

If you want to play around with it for educational purposes however, the field type you're looking for is BLOB. Aptly named because this is what your database will do with a few hundred to thousand PDFs stored in it.
delayedinsanity 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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Generating XML from a Mysql DB with PHP's DOM functions (part one) sketchMedia XML, XSLT, XPath, XQuery 10 03-05-2013 07:41 AM
feedback on my class please frostyboy33 Advanced PHP Programming 7 10-22-2012 09:12 AM
How can i read an image from the inside of a php file skibbli General 1 06-06-2010 03:21 AM
Databse structure Village Idiot TalkPHP Developer Team 3 01-16-2009 10:31 PM
This project has begun! Village Idiot TalkPHP Developer Team 40 01-01-2009 04:29 AM


All times are GMT. The time now is 07:29 PM.

 
     

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