时间:2021-07-01 10:21:17 帮助过:10人阅读
BLOB是一种MySQL数据类型,称为二进制大对象。正如它的名字它是用来存储类似MYSQL二进制和VARBINARY类型的、大量的字符串数据。
MySQL BLOB分类
LONGBLOB ((2 ^ 32)1)
CREATE TABLE IF NOT EXISTS `output_images` ( `imageId` tinyint(3) NOT NULL AUTO_INCREMENT, `imageType` varchar(25) NOT NULL DEFAULT '', `imageData` mediumblob NOT NULL, PRIMARY KEY (`imageId`) )
0) { if(is_uploaded_file($_FILES['userImage']['tmp_name'])) { mysql_connect("localhost", "root", ""); mysql_select_db ("phppot_examples"); $imgData =addslashes(file_get_contents($_FILES['userImage']['tmp_name'])); $imageProperties = getimageSize($_FILES['userImage']['tmp_name']); $sql = "INSERT INTO output_images(imageType ,imageData) VALUES('{$imageProperties['mime']}', '{$imgData}')"; $current_id = mysql_query($sql) or die("Error: Problem on Image Insert
" . mysql_error()); if(isset($current_id)) { header("Location: listImages.php"); }}} ?>Upload Image to MySQL BLOB
Error: Problem on Retrieving Image BLOB
" . mysql_error()); $row = mysql_fetch_array($result); header("Content-type: " . $row["imageType"]); echo $row["imageData"]; } mysql_close($conn); ?>
" />
List BLOB Images " />
http://www.bkjia.com/PHPjc/678029.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/678029.htmlTechArticleBLOB是一种 MySQL 数据类型,称为二进制大对象。正如它的名字它是用来存储类MYSQL二进制和VARBINARY类型的、大量的字符串数据。 MySQL BLOB分类...