還是圖片上傳顯示問題
還是圖片上傳顯示問題,經改進圖片還是顯示不了
upload.php:
Store binary data into SQL Database
if (isset($_POST['submit'])) {
$form_description = $_POST['form_description'];
$form_data_name = $_FILES['form_data']['name'];
$form_data_size = $_FILES['form_data']['size'];
$form_data_type = $_FILES['form_data']['type'];
$form_data = $_FILES['form_data']['tmp_name'];
$connect = MYSQL_CONNECT( "localhost", "root", "123") or die("Unable to connect to MySQL server");
mysql_select_db( "db_database18") or die("Unable to select database");
$data = addslashes(fread(fopen($form_data, "r"), filesize($form_data)));
$result=MYSQL_QUERY( "INSERT INTO ccs_image (description,bin_data,filename,filesize,filetype) VALUES ('$form_description','$data','$form_data_name','$form_data_size','$form_data_type')");
$id= mysql_insert_id();
print "
This file has the following Database ID: $id";
MYSQL_CLOSE();
} else {
?>
}
?>
imglist.php
$connect = MYSQL_CONNECT( "localhost", "root", "123") or die("Unable to connect to MySQL server");
mysql_select_db( "db_database18") or die("Unable to select database");
$result=mysql_query("SELECT * FROM ccs_image") or die("Can't Perform Query");
While ($row=mysql_fetch_object($result)){
echo "
";
}
?>
show.php
if(isset($_GET['id'])) {
$id = $_GET['id'];
$connect = MYSQL_CONNECT( "localhost", "root", "sa") or die("Unable to connect to MySQL server");
mysql_select_db( "test") or die("Unable to select database");
$query = "select bin_data,filetype from ccs_image where id=".$id;
$result = @MYSQL_QUERY($query);
$data = @MYSQL_RESULT($result,0, "bin_data");
$type = @MYSQL_RESULT($result,0, "filetype");
Header( "Content-type: $type");
echo $data;
}
?>
我來回答
網站建意與解決方法
已解決
網站建意與解決方法
非生產系統的話, 建議把所有錯誤信息都顯示出來吧。
網站建意與解決方法
什麼原因?分享一下結果撒。。。