В една папка си качват два различни файла. има и два download файла проблема е че сваля само единият файл това и файловете
downsub.php
ето и другия
download.php
какво да правя
ето линковете за сваляне на всеки файл
единият
а ето и другият
downsub.php
Код:
<?php
session_start();
require "../config.php";
$id = (int) $_GET['id'];
$result = mysql_query("SELECT sub FROM `moves` WHERE `id` = '$id' LIMIT 0,1") or die (mysql_error());
$row = mysql_fetch_array($result);
if ($row && file_exists($file = $row['file']))
{
header("Pragma: public");
header('Content-Type: application/octet-stream');
header("Cache-Control: private",false);
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . @filesize($file));
header("Content-Description: File Transfer");
header('Content-Disposition: attachment; filename=' . basename($file));
readfile($file);
exit;
}
header('HTTP/1.0 404 NOT FOUND');
?>
download.php
Код:
<?php
session_start();
require "../config.php";
$id = (int) $_GET['id'];
$result = mysql_query("SELECT file FROM `moves` WHERE `id` = '$id' LIMIT 0,1") or die (mysql_error());
$row = mysql_fetch_array($result);
if ($row && file_exists($file = $row['file']))
{
header("Pragma: public");
header('Content-Type: application/octet-stream');
header("Cache-Control: private",false);
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . @filesize($file));
header("Content-Description: File Transfer");
header('Content-Disposition: attachment; filename=' . basename($file));
readfile($file);
exit;
}
header('HTTP/1.0 404 NOT FOUND');
?>
ето линковете за сваляне на всеки файл
единият
Код:
<a href='movies/files/download.php?id=$data[id]' style='text-decoration: none;'>DOWNLOAD</а>
Код:
<a href='movies/files/downsub.php?id=$data[id]'><img src='buton.jpg' alt='buton' width='100px' style='margin-left:230px;' /></a>