还是图片上传显示问题
程序员文章站
2022-05-24 08:03:40
...
还是图片上传显示问题
还是图片上传显示问题,经改进图片还是显示不了
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 "
}
?>
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 "id."'>
";
}
?>
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;
}
?>
我来回答
网站建意与解决方法
已解决
网站建意与解决方法
非生产系统的话, 建议把所有错误信息都显示出来吧。
网站建意与解决方法
什么原因?分享一下结果撒。。。
还是图片上传显示问题,经改进图片还是显示不了
upload.php:
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 "id."'>
";
}
?>
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;
}
?>
我来回答
网站建意与解决方法
已解决
网站建意与解决方法
非生产系统的话, 建议把所有错误信息都显示出来吧。
网站建意与解决方法
什么原因?分享一下结果撒。。。
上一篇: canvas探照灯效果
下一篇: PHP搜索结果分页显示有关问题。
推荐阅读
-
善用抓包软件fiddler解决discuz中图片上传浏览器兼容性问题
-
在做一个图片展示网站。想知道图片是如何存的?url?还是直接上传到服务器然后拿到他的路径
-
前景图片叠加问题,前景图片为png,格子透明,在ie8下显示不正常_html/css_WEB-ITnose
-
PHP AJAXFORM提交图片上传并显示图片源码
-
解决BootStrap Fileinput手机图片上传显示旋转问题
-
javascript 火狐(firefox)不显示本地图片问题解决
-
js 上传图片预览问题
-
PHP AjaxForm提交图片上传并显示图片源码_php实例
-
php fck文件夹及上传图片中文乱码有关问题解决办法
-
access-PHP将十六进制流转换成图片显示在页面中的问题