bx93 0 Report post Posted October 2, 2004 The starter hosting at Xisto.com supports only 20M space for the pages. But thanks OpaQue, the MySql database space is not limited.These days, I conducted an evaluation using MySql database to operate the image. First, create the database and table(which I had already introduce at the database session), upload the images and insert them into MySql database. When review the pages, these images are retrieved from the database and shown in the pages. The code is as following:table structure:CREATE TABLE `files` ( `id` int(10) NOT NULL auto_increment, `name` varchar(200) NOT NULL default '', `type` varchar(30) NOT NULL default '', `size` int(10) NOT NULL default '0', `data` text NOT NULL, PRIMARY KEY (`id`)) TYPE=MyISAM AUTO_INCREMENT=21 ;storedata.php<? $file_uploaded = $userfile; $filehandle = fopen($file_uploaded, "rb") or die( "Can't open file!" ); $filedata = ''; while (!feof($filehandle)) { $data = chunk_split(base64_encode(fread($filehandle,102400))); $filedata = $filedata.$data; } fclose ($filehandle); $query= "INSERT INTO files (name, type, size, data) VALUES('".$_FILES['userfile']['name']."','".$_FILES['userfile']['type']."',".$_FILES['userfile']['size'].", '$filedata');"; mysql_query($query);?>fetchdata.php<? $query= "SELECT data FROM files where name='$fname'"; $result = mysql_query($query); $row = mysql_fetch_row($result); $fdata = $row[0]; echo base64_decode($fdata);?>Assume these is a py1.gif has been stored into the database, it could be displayed as following:<img src='fetchdata.php?fname=py1.gif'>Thanks to Eric, he help me when I have the problem with the display on pages. Share this post Link to post Share on other sites
bx93 0 Report post Posted October 2, 2004 All the code works at my web pages. However, there still some problems with such method.1. The speed, during the evaluation, I found the speed is not so good especially when the page is reviewed at the second time. The displaying from files is more fast than from database.2. Hard to operate the swf(flash type) file. I have some swfs to display in the pages. But I didn't find the way to operate it with MySql database currently.If there is someone else here to try it? Share this post Link to post Share on other sites