|
|
|
PHP + SQL Server + OPENROWSET จะอ่านแบบ Binary ได้อย่างไรครับ |
|
|
|
|
|
|
|
Code (PHP)
<?
if($_FILES["filUpload"]["name"] != "")
{
//*** Insert Record ***//
$objConnect = mssql_connect("localhost","sa","") or die("Error Connect to Database");
$objDB = mssql_select_db("mydatabase");
$strSQL = "INSERT INTO files ";
$strSQL .=" ( Name, FilesType,FilesName) ";
$strSQL .=" SELECT '".$_POST["txtName"]."','".$_FILES["filUpload"]["type"]."', ";
$strSQL .=" BulkColumn FROM OPENROWSET( ";
$strSQL .=" Bulk '".$_FILES["filUpload"]["tmp_name"]."', SINGLE_BLOB) AS BLOB ";
$objQuery = mssql_query($strSQL);
echo "Copy/Upload Complete<br>";
mssql_close($objConnect);
}
?>
Go to : PHP Upload File BLOB/Image to SQL Server Database (mssql-OPENROWSET)
|
|
|
|
|
Date :
2011-07-20 21:11:16 |
By :
thaicreate |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|