Or is there a problem with image upload display
It’s still a display problem when uploading images. After improvements, the images still can’t be displayed
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;
}
?>
Let me answer
Website ideas and solutions
Solved
Website ideas and solutions
For non-production systems, it is recommended to display all error messages.
Website ideas and solutions
What's the reason? Share the results. . .
http://www.bkjia.com/PHPjc/632506.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632506.htmlTechArticleIs it still a problem with image upload display or image upload display problem? After improvement, the image still cannot be displayed upload.php: Store binary data into SQL Database if (isset($_POST['submit'])) { $fo...