id.">
Rumah > pembangunan bahagian belakang > tutorial php > 还是图片上传显示问题_PHP教程

还是图片上传显示问题_PHP教程

WBOY
Lepaskan: 2016-07-13 10:52:30
asal
766 orang telah melayarinya




还是图片上传显示问题



还是图片上传显示问题,经改进图片还是显示不了

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 "还是图片上传显示问题_PHP教程
";
}
?>



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;
}
?>

我来回答




网站建意与解决方法
已解决

网站建意与解决方法
非生产系统的话, 建议把所有错误信息都显示出来吧。

网站建意与解决方法
什么原因?分享一下结果撒。。。


www.bkjia.comtruehttp://www.bkjia.com/PHPjc/632506.htmlTechArticle还是图片上传显示问题 还是图片上传显示问题,经改进图片还是显示不了 upload.php: Store binary data into SQL Database if (isset($_POST['submit'])) { $fo...
Label berkaitan:
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan