I have two php files
1. List_files ->show all uploaded files
2. Get_file ->to download files from listed files...
Şimdi ben herhangi bir görüntü veya herhangi bir metin dosyasını indirmek ve açtı almıyor açmaya çalıştığınızda,
Hata biçimi her desteklenmiyor.
Benim görüntü. Jpeg
I am using Windows Vista with Firefox.
No problem in downloading, problem is in opening the file..
get_file.php
<?php
// Make sure an ID was passed
if(isset($_GET['id']))
{
// Get the ID
$id = intval($_GET['id']);
// Make sure the ID is in fact a valid ID
if($id <= 0)
{
die('The ID is invalid!');
}
else
{
// Connect to the database
$con=mysql_connect("localhost","root","");
if(!$con)
{
die('Could Not Connect:'.mysql_error());
}
mysql_select_db("tcs",$con);
// Fetch the file information
$query = "SELECT `mime`, `name`, `size`, `data` FROM `file` WHERE `id` = {$id}";
$result=mysql_query($query,$con);
if($result)
{
$count = mysql_num_rows($result); // Make sure the result is valid
if($count == 1)
{
// Get the row
$row = mysql_fetch_array($result);
// Print headers
header("Content-Type: ".$row['mime']);
header("Content-Length: ".$row['size']);
header("Content-Disposition: attachment; filename=".$row['name']);
// Print data
echo $row['data'];
}
else
{
echo 'Error! No image exists with that ID.';
}
// Free the mysqli resources
//mysql_free_result($result);
}
else
{
echo "Error! Query failed: <pre>".mysql_error()."</pre>";
}
mysql_close();
}
}
else
{
echo 'Error! No ID was passed.';
}
?>