the script that show image is :
<?php
include('dbinfo.inc.php');
mysql_connect($localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "SELECT file,filesize,filetype FROM user WHERE id=1;";
$result=mysql_query($query);
mysql_close();
$file=mysql_result($result,0,"file");
$filesize=mysql_result($result,0,"filesize");
$filetype=mysql_result($result,0,"filetype");
header('Content-Type: '.$filetype);
header("Content-Disposition: attachement\n");
print $file;
?>
it's work fine execpt it show the image as a attachement
(Save as... window), so Apache, mysql, php seem to work fine.
the problem is only on http header of image i think.
i want the image directly so, i use this :
<?php
include('dbinfo.inc.php');
mysql_connect($localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "SELECT file,filesize,filetype FROM user WHERE id=1;";
$result=mysql_query($query);
mysql_close();
$file=mysql_result($result,0,"file");
$filesize=mysql_result($result,0,"filesize");
$filetype=mysql_result($result,0,"filetype");
header('Content-Type: '.$filetype);
print $file;
?>
it's don't work, firefox gave me "The image
http://ip:8080/viewimage.php
cannot be displayed, because it contains error."
IE show me nothing at all.
any one have a idea ?
----------------------------------------------------
Windows NT 5.1 build 2600 (XP Professional English)
Apache 2.0.54, running as a server
PHP Version 5.0.4 running as module
MySQL 4.1.7 (a dll from php)
Firefox english 1.0.4
Internet Explorer 6
th**********@gmail.com