temprarely download problem (download.php)
Posted: Fri Nov 25, 2011 6:22 pm
any one help me please i have problem in download.php
<?php
include('core/init.inc.php');
if (isset($_GET['file_id'])) {
$file_id = (int)$_GET['file_id'];
$file = mysql_query("SELECT `file_name`, `file_expiry` FROM `files` WHERE `file_id` = {$file_id}");
if (mysql_num_rows($file) !=1) {
echo 'file ID is invalid';
}
else {
$rows = mysql_fetch_assoc($file);
if ($row['file_expiry'] < time()){
echo "this file hase been expired";
}
else{
$path = "core/file/{$row['file_name']}";
header('content-Type: application/octetstream');
header('Content-Type: application/octet-stream');
header('Content-Description: File Transfer');
//header(Content-Description: attachment; filename=\{$row['file_name']}\);
header('Content-Length:' . filesize($path));
readfile($path);
}
}
}
?>
<html>
<head>
<title>better php blog tutorials</title>
</head>
<body>
<div>
</body>
</html>
<?php
include('core/init.inc.php');
if (isset($_GET['file_id'])) {
$file_id = (int)$_GET['file_id'];
$file = mysql_query("SELECT `file_name`, `file_expiry` FROM `files` WHERE `file_id` = {$file_id}");
if (mysql_num_rows($file) !=1) {
echo 'file ID is invalid';
}
else {
$rows = mysql_fetch_assoc($file);
if ($row['file_expiry'] < time()){
echo "this file hase been expired";
}
else{
$path = "core/file/{$row['file_name']}";
header('content-Type: application/octetstream');
header('Content-Type: application/octet-stream');
header('Content-Description: File Transfer');
//header(Content-Description: attachment; filename=\{$row['file_name']}\);
header('Content-Length:' . filesize($path));
readfile($path);
}
}
}
?>
<html>
<head>
<title>better php blog tutorials</title>
</head>
<body>
<div>
</body>
</html>