My upload script is uploaded images file name and others details of images in database and then it save images itself in directory(server).
Then I do have another script to download images files that are in directory and and details of images file that are in database. But the trouble that I'm having at moment when run download script I can seen the links of images details in database but when I clicked to open images I can't view the images that were uploaded.
There is any way I can display images that are in directory and with details of images that are stored in database together when run download script. Please if you have some conceptd about it help. Thanks
Here my download script.
<?php
error_reporting(E_ALL);
if(isset($_GET['id']))
{
include 'library/config.php';
include 'library/opendb.php';
$id = $_GET['id'];
$query = "SELECT name, type, size, path FROM upload2 WHERE id = '$id' ";
$result = mysql_query($query) or die('Error, query failed');
list($name, $type, $size, $filePath) = mysql_fetch_array($result);
header("Content-Disposition: attachment; filename=$name");
header("Content-length: $size");
header("Content-type: $type");
readfile($filePath);
include 'library/closedb.php';
exit;
}
?>
<html>
<head>
<title>Download File From File Server</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
include 'library/config.php';
include 'library/opendb.php';
$query = "SELECT id, name FROM upload2";
$result = mysql_query($query) or die('Error, query failed');
if(mysql_num_rows($result) == 0)
{
echo "Database is empty <br>";
}
else
{
while(list($id, $name) = mysql_fetch_array($result))
{
?>
<br>
<img src="download2.php?id=<?php echo $id ?>" alt="Images" />
//<a href="download2.php?id=<?php echo $id; ?>"><?php echo $name; ?></a> <br>
<?php
}
}
include 'library/closedb.php';
?>
</body>
</html>

New Topic/Question
Reply




MultiQuote




|