|
|
|
ขอโค้ดอัพรูปภาพเก็บชื่อไฟล์ลงดาต้าเบสและไฟล์รูปที่โฟลเดอร์รูป |
|
|
|
|
|
|
|
บทความนี้ครับ
Code (PHP)
<?
if($_FILES["filUpload"]["name"] != "")
{
//*** Read file BINARY ***'
$fp = fopen($_FILES["filUpload"]["tmp_name"],"r");
$ReadBinary = fread($fp,filesize($_FILES["filUpload"]["tmp_name"]));
fclose($fp);
$FileData = addslashes($ReadBinary);
//*** Insert Record ***//
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("mydatabase");
$strSQL = "INSERT INTO files ";
$strSQL .="(Name,FilesName) VALUES ('".$_POST["txtName"]."','".$FileData."')";
$objQuery = mysql_query($strSQL);
echo "Copy/Upload Complete<br>";
mysql_close($objConnect);
}
?>
PHP Upload MySQL BLOB Image (BLOB Binary Data in a MySQL Database)
|
|
|
|
|
Date :
2015-11-16 17:36:36 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|