|
|
|
PHP อัพโหลดรูปภาพลงในฐานข้อมูล Microsoft Access แบบ BLOB Binary |
|
|
|
|
|
|
|
Code (PHP)
<html>
<head>
<title>ThaiCreate.Com Tutorial</title>
</head>
<body>
<?
if($_FILES["filUpload"]["name"] != "")
{
//*** Insert Record ***//
$objConnect = odbc_connect("mydatabase","","") or die("Error Connect to Database");
$DataImage = file_get_contents($_FILES['filUpload']['tmp_name']);
$ArrData = unpack("H*hex", $DataImage);
$HexData = "0x".$ArrData['hex'];
$strSQL = "INSERT INTO files ";
$strSQL .=" ( Name, FilesType,FilesName) ";
$strSQL .=" VALUES ";
$strSQL .=" ( '".$_POST["txtName"]."', '".$_FILES["filUpload"]["type"]."','".$HexData."') ";
$objExec = odbc_exec($objConnect, $strSQL);
echo "Copy/Upload Complete<br>";
}
?>
<a href="PageUploadToAccess3.php">View files</a>
</body>
</html>
Go to : PHP Upload BLOB into Access Database (Access BLOB Binary)
|
|
|
|
|
Date :
2011-05-25 22:47:21 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|