สอบถามการ select type image บน mssql ด้วยภาษา php หน่อยครับ
Code (PHP)
<?
if($_FILES["upfile"]["name"] != "Please Insert Images")
{
$FileName = $_FILES['upfile']['tmp_name'];
$Name=$_FILES["upfile"]["name"];
$Size=$_FILES["upfile"]["size"];
$Type=$_FILES["upfile"]["type"];
$DataImage = file_get_contents($FileName );
$ArrData = unpack("H*hex", $DataImage);
$HexData = "0x".$ArrData['hex'];
//*** Insert Record ***//
$Connect = mssql_connect("yourhost","user","pass") or die("Error Connect to DB");
$DB = mssql_select_db("Database");
$SQL = "INSERT INTO Images ";
$SQL .="(Img_Name,Img_Size,Img_Data,Img_Type)
VALUES ( '$Name','$Size',$HexData,'$Type' )";
$Query = mssql_query($SQL) or die ("error ");
echo "Upload Complete<br>";
echo "<a href='Img_show.php'>View_img </a> ";
}
?>
PHP SQL Server BLOB การ Upload และ Insert รูปภาพลงใน
Date :
2015-07-20 15:01:09
By :
mr.win
Load balance : Server 00