Variablez 0 Report post Posted October 17, 2008 Hey im trying to add a file to my My SQL Database, Any idea how I can do this? Any help would be appriciated. Thanks! Share this post Link to post Share on other sites
Evolix 1 Report post Posted October 17, 2008 What do you mean you want to add a file to your MySQL database? Do you mean importing a file into it via phpMyAdmin? Share this post Link to post Share on other sites
galexcd 0 Report post Posted October 17, 2008 Although not advised for storing large files, you can include files directly into mysql by using the BLOB type. Unfortunately mysql databases normally don't have very much space allocated to them because they mostly store text so you might find that it is easier to upload files to a directory on your website and reference them from sql. If you are still sure you want to do this, and if you are trying to do this from php, this tutorial might help you on your way. Share this post Link to post Share on other sites
jlhaslip 4 Report post Posted October 17, 2008 I am Alpha testing a CMS that stores the Template file and the CSS file in a Database and allows changes to be made to them via the Admin Panel for the CMS instead of using an FTP program and an editor. How cool is that?So, storing files as a Database record is easy enough to do.Here is the SQL for the Templates Table. You can add Templates and select whichever one you have added as the displayed Template via the Admin Panel. The CSS files are handled the same, except in a different Table. CREATE TABLE IF NOT EXISTS `templates` ( `id` int(11) NOT NULL auto_increment, `name` varchar(100) NOT NULL, `template` longtext, `main_temp` char(3) NOT NULL default 'YES', `css` varchar(8) default NULL, PRIMARY KEY (`id`));The 'template' element of the Table stores the actual, full html as type=longtext. Share this post Link to post Share on other sites