dbfiles is a plugin that enables storage of files to the MySQL database. Why store files in a database? Short answer: it is easier to handle file meta
This is the setup I have tested with. Please let me and the community know if you have got it working on other conjfigurations!
Test environment: Windows XP SP2 (http://www.microsoft.com/windowsxp) Apache httpd 2.0.54 (http://httpd.apache.org) PHP 5.0.4 (http://www.php.net) MySQL 4.1.13-nt (http://www.mysql.org) Wordpress 1.5.2 (http://www.wordpress.org)
Production environment: FreeBSD or OpenBSD (my hosting company wont give away exactly which of them I use) Apache httpd 1.3.33 (http://httpd.apache.org) PHP 4.x (http://www.php.net) MySQL 4.0.18 (http://www.mysql.org) Wordpress 1.5.2 (http://www.wordpress.org)
This is how the structure should look when installed correctly:
/wordpress/plugins/dbfile/dbfile.inc - the db_file class with all functionality to access database files dbfile.php - all actions (edit, view, get, delete) are handled via this file dbfiles.php - the plugin main activation file LICENSE.TXT - GPL license readme.txt - this file
The files table (defaults to wp_files in the WordPress database) consists of these fields: id - the id of the database file name - the name of the file mimeType - the mime type of the file, i.e. image/png for a .png file content - the actual file, stored as a blob - binary large object description - a short description of the file created - date and time when the file was uploaded (first time) modified - date and time when the file was modified/uploaded (after first time) hits - the number of times the file has been downloaded/viewed. This only increments if hit counting is turned on with the dbfile_use_hitcounter option.
The post2file table (defaults to wp_post2file in the WordPress database) consists of these fields: relID - the relational id postID - the id of the post record dbfileID - the id of the dbfile record sortNo - the sorting number used when displaying dbfiles in a post, to sort the entries For now, the dbfile plugin handles only one to one relation between a post and a dbfile. This is soon to be changed.
dbfile_use_fileupload - "1" to enable uploads, "0" to disable. Default is "0" dbfile_database - The name of the database to use for upload/download of files. Defaults to "wordpress" (or whatever you have named it). dbfile_table - The name of the table to use for upload/download of files. Defaults to "wp_files" (actually the wp_ part is dynamically fetched from your installation). dbfile_post2file_table - The name of the table to use for relations between posts and db files. Defaults to "wp_post2file" (the wp_ part is dynamically fetched from your installation). dbfile_upload_maxk - The maximum number of kilobytes that will be received when uploading. Defaults to 300 dbfile_upload_allowedtypes - The file extensions that are allowed to be uploaded, separated by spaces. Defaults to "jpg jpeg gif png" dbfile_upload_minlevel - The minimum user level required to upload files. Defaults to 6. dbfile_preview_types - The file types that should be previewed when editing a file, separated with space, excluding the extension dot Defaults to jpg jpeg gif png dbfile_entry - The structure of a dbfile entry in a post. Use %name and %link inside the string Defaults to
As this is a new project, there are several items/bugs that could be fixed in the future: * Localization * Check FIXMEs * Security/SQL-injection? * Compression * Use the ORIGINAL created and modified of the file? Add a field "uploaded" to wp_files then. * Follow WordPress coding standards * Different files for the different actions? adddbfile.php, editdbfile.php, admindbfiles.php? * Add "read" and "edit" rights to files * Separate content from presentation better * Remove hard coded links/paths * More documentation * Sortable table in Database File Management (see http://www.kryogenix.org/code/browser/sorttable/ for an example) * Nicer error messages for users (XHTML compliant) * Integrate with the image/file browser in ChenPress/FCKeditor * Caching (on/off) (cache files on filesystem?) * Add referrer checking, so external sites can not link directly (on/off) * Change the content field in the files table to LONGBLOB * Export files from the database to the file system * Rename files