Hi, Yes, That is true. I've heard of some programmers saying that using BLOB field can bloat and reduce DB performance. I guess that would really be a factor of system load and delivery expectations.
Mike -- Mike Brandonisio * IT Planning & Support Tech One Illustration * Database Applications tel (630) 759-9283 * e-Commerce [EMAIL PROTECTED] * www.techoneillustration.com On Sep 9, 2005, at 10:06 AM, David Smyth wrote: > Yes, that's what it does. I guess if you wanted it as a file on the > server file system you'd just upload and save it to the file system > instead of saving it to the database in the first place. > > David. > > --- In [email protected], Mike Brandonisio <[EMAIL PROTECTED]> > wrote: > >> Hi, >> >> Does the link provide a file stream to the browser requesting it and >> does not create a file on the server file system? >> >> Mike >> -- >> Mike Brandonisio * IT Planning & Support >> Tech One Illustration * Database Applications >> tel (630) 759-9283 * e-Commerce >> [EMAIL PROTECTED] * www.techoneillustration.com >> >> On Sep 9, 2005, at 9:16 AM, David Smyth wrote: >> >> >>> Hi Mike, >>> >>> Basically the implementation I have is that a document is >>> uploaded for >>> a used to download. So I provide a hyperlink for them to click on >>> that >>> calls a php file that gets the record from a query, then output the >>> file. >>> >>> ie. >>> >>> <a href="show.php?n=3">Click here to download</a> >>> >>> show.php runs the query, then outputs a series of headers >>> relating to >>> the file before echo'ing the content of the file. >>> >>> $document_id = "1"; >>> if (isset($_GET['n'])) { >>> $document_id = (get_magic_quotes_gpc()) ? $_GET['n'] : >>> addslashes($_GET['n']); >>> } >>> >>> mysql_select_db($database, $link); >>> $documentSQL = sprintf("SELECT * FROM document WHERE documentid = >>> %s", >>> $document_id); >>> $result_document = mysql_query($documentSQL, $link) or die >>> (mysql_error()); >>> $row_document = mysql_fetch_assoc($result_document); >>> $document_num_rows = mysql_num_rows($result_document); >>> $data = $row_document['file']; >>> #MYSQL_RESULT($pdf,0, "file"); >>> $filename = $row_document['fileName']; >>> $ctype = $row_document['fileType']; >>> header("Pragma: public"); >>> header("Expires: 0"); >>> header("Cache-Control: must-revalidate, post-check=0, precheck=0"); >>> header("Cache-Control: public"); >>> header("Content-Description: File Transfer"); >>> header("Content-type: $ctype"); >>> $header = "Content-Disposition: attachment; filename=$filename;"; >>> header($header); >>> header("Content-Transfer-Encoding: binary"); >>> echo $data; >>> >>> mysql_free_result($result_document); >>> >>> >>> I do however have a couple of problems using this approach of >>> storing >>> files in the database. Firstly my host only allows a maximum file >>> size >>> of 1MB for uploads into a mySQL database. Secondly, it eats up >>> database space so I keep having to upgrade my database space with my >>> host. Other than that, works a treat. >>> >>> David. >>> --- In [email protected], Mike Brandonisio <[EMAIL PROTECTED]> >>> wrote: >>> >>> >>>> Hi, >>>> >>>> Here comes the dumb question: Once you get it into the BLOB >>>> field of >>>> the DB How do you get back out to view or use it? Do you write a >>>> query to to select the record then write the BLOB back to a file on >>>> the server and manipulate the newly created file? >>>> >>>> Mike >>>> -- >>>> Mike Brandonisio * Web Hosting >>>> Tech One Illustration * Internet Marketing >>>> tel (630) 759-9283 * e-Commerce >>>> [EMAIL PROTECTED] * http://www.jikometrix.net >>>> >>>> JIKOmetrix - Reliable web hosting >>>> >>>> >>>> On Sep 9, 2005, at 4:24 AM, David Smyth wrote: >>>> >>>> >>>> >>>>> Hi Suminth, >>>>> >>>>> I use the code below to do just this. You will require a BLOB data >>>>> type field in your database (or LONGBLOB) depending on your file >>>>> size >>>>> requirements. >>>>> >>>>> The code reads the binary content of the file and saves it to the >>>>> MYSQL database which is what, I assume, you are after. If you >>>>> want to >>>>> make sure that people just upload word files then you'll need >>>>> to do >>>>> some checking on the fileType variable. >>>>> >>>>> <!--Start code >>>>> $file = $_FILES['file']['tmp_name']; >>>>> $fileName = $_FILES['file']['name']; >>>>> $fileType = $_FILES['file']['type']; >>>>> $fileSize = $_FILES['file']['size']; >>>>> >>>>> if ($file){ >>>>> $data = addslashes(fread(fopen($file, "r"), filesize($file))); >>>>> } >>>>> mysql_select_db($database_cairncapital, $cairncapital); >>>>> $result=mysql_query("INSERT INTO document (title, publishdate, >>>>> `file`, >>>>> fileName, fileType, fileSize, summary) VALUES >>>>> ('$document_title','$document_date', '$data', '$fileName', >>>>> '$fileType', '$fileSize', '$summary')") or die(mysql_error()); >>>>> -->End Code >>>>> >>>>> Hope this helps, if you need the code to get the file back out of >>>>> the >>>>> database when required then let me know. >>>>> >>>>> David. >>>>> >>>>> --- In [email protected], sumanth kiuumar >>>>> <[EMAIL PROTECTED]> >>>>> wrote: >>>>> >>>>> >>>>> >>>>>> Hi friends, >>>>>> >>>>>> In the project in which i m working has the following >>>>>> requirement. >>>>>> >>>>>> It is like a CV Registration. >>>>>> >>>>>> There is a form with the fields like name,age, experience, >>>>>> current >>>>>> >>>>>> >>>>>> >>>>> employer, previous employer, salary and upload ur cv. >>>>> >>>>> >>>>> >>>>>> In this when the user fills the form and uploads his resume, the >>>>>> >>>>>> >>>>>> >>>>> data should be stored in a database including the CV. >>>>> >>>>> >>>>> >>>>>> >>>>>> Can anyone send me the code so that i can get some idea on how it >>>>>> works >>>>>> >>>>>> >>>>>> --------------------------------- >>>>>> Do you Yahoo!? >>>>>> The New Yahoo! Movies: Check out the Latest Trailers, Premiere >>>>>> >>>>>> >>>>>> >>>>> Photos and full Actor Database. >>>>> >>>>> >>>>> >>>>>> >>>>>> [Non-text portions of this message have been removed] >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>>> >>>>> >>>>> ------------------------ Yahoo! Groups Sponsor >>>>> -------------------- >>>>> ~--> >>>>> Most low income households are not online. Help bridge the digital >>>>> divide today! >>>>> http://us.click.yahoo.com/cd_AJB/QnQLAA/TtwFAA/CefplB/TM >>>>> ------------------------------------------------------------------ >>>>> -- >>>>> ~-> >>>>> >>>>> The php_mysql group is dedicated to learn more about the PHP/MySQL >>>>> web database possibilities through group learning. >>>>> Yahoo! Groups Links >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>> >>> >>> >>> >>> ------------------------ Yahoo! Groups Sponsor -------------------- >>> ~--> >>> Fair play? Video games influencing politics. Click and talk back! >>> http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/CefplB/TM >>> -------------------------------------------------------------------- >>> ~-> >>> >>> The php_mysql group is dedicated to learn more about the PHP/MySQL >>> web database possibilities through group learning. >>> Yahoo! Groups Links >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> > > > > > ------------------------ Yahoo! Groups Sponsor -------------------- > ~--> > Fair play? Video games influencing politics. Click and talk back! > http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/CefplB/TM > -------------------------------------------------------------------- > ~-> > > The php_mysql group is dedicated to learn more about the PHP/MySQL > web database possibilities through group learning. > Yahoo! Groups Links > > > > > > > > > ------------------------ Yahoo! Groups Sponsor --------------------~--> Fair play? Video games influencing politics. Click and talk back! http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/CefplB/TM --------------------------------------------------------------------~-> The php_mysql group is dedicated to learn more about the PHP/MySQL web database possibilities through group learning. Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/php_mysql/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
