Page 1 of 1

temprarely download problem (download.php)

Posted: Fri Nov 25, 2011 6:22 pm
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>

Re: temprarely download problem (download.php)

Posted: Fri Nov 25, 2011 7:38 pm
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?

Re: temprarely download problem (download.php)

Posted: Fri Nov 25, 2011 10:17 pm
by jacek
Please follow at least some of the posting guidelines !