temprarely download problem (download.php)

Talk about anything in here.
Locked
rizwan
Posts: 3
Joined: Fri Nov 25, 2011 6:15 pm

temprarely download problem (download.php)

Post by rizwan »

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>
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: temprarely download problem (download.php)

Post by Temor »

please use the code tags.
[syntax=php]Code goes here
[/syntax]

And also, what is the problem? Explain.
Do you get any errors?
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: temprarely download problem (download.php)

Post by jacek »

Please follow at least some of the posting guidelines !
Image
Locked