|
|
|
เกี่ยวกับการเก็บข้อมูลรูปภาพลงฐานข้อมูล 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 :
2012-06-23 09:15:04 |
By :
thaicreate |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|