Tools, FAQ, Tutorials:
Creating a Database Table to Store Files in PHP
How To Create a Table To Store Files in PHP?
✍: FYIcenter.com
If you using MySQL database and want to store files in database, you need to create BLOB columns, which can holds up to 65,535 characters. Here is a sample script that creates a table with a BLOB column to be used to store uploaded files:
<?php
$con = mysql_connect("localhost", "", "");
mysql_select_db("fyi");
$sql = "CREATE TABLE fyi_files ("
. " id INTEGER NOT NULL AUTO_INCREMENT"
. ", name VARCHAR(80) NOT NULL"
. ", type VARCHAR(80) NOT NULL"
. ", size INTEGER NOT NULL"
. ", content BLOB"
. ", PRIMARY KEY (id)"
. ")";
mysql_query($sql, $con);
mysql_close($con);
?>
⇒ Uploading Files into Database in PHP
⇐ Filtering Out Empty Files in PHP
2016-10-14, ∼2881🔥, 0💬
Popular Posts:
How To Copy Array Values to a List of Variables in PHP? If you want copy all values of an array to a...
How to create a navigation file like navigation.xhtml for an EPUB 3.0 book? At least one navigation ...
How To Get the Minimum or Maximum Value of an Array in PHP? If you want to get the minimum or maximu...
How to Install Docker Desktop 2.5.0 on Windows 10? You can follow this tutorial to Install Docker De...
Where to find tutorials on OpenID? Here is a large collection of tutorials to answer many frequently...