0
我試圖存儲在MySQL中的圖像和得到警告警告:非法串偏移「啞劇」
非法抵消下面的代碼「默」
:
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
$conn = mysql_connect("localhost","root","");
$db = mysql_select_db("imagestore",$conn);
if(!$db)
{
echo mysql_error();
}
$rollNo = $_POST['rollNo'];
$image = addslashes (file_get_contents($_FILES['image']['tmp_name']));
$image_s=getimagesize($_FILES['image']['tmp_name']);
$imgtype = $image['mime'];
$q = "INSERT INTO students VALUES('','$rollNo','$image','$imgtype')";
$r=mysql_query($q,$conn);
if($r)
{
echo "Information stored successfully";
}
else
{
echo mysql_error();
}
?>
如何解決?
要在哪裏存儲圖像? – C2486
也許這將有助於http://stackoverflow.com/questions/27591379/cant-upload-and-store-the-image-to-the-database-by-using-php –