I'm having a little trouble. I followed the "Temporary File Download System" tutorial but I decided to leave out the expiry time. Here is my download page code:
<?php require ('core/inc/init.inc.php'); if(isset($_GET['file'])) { $file = (int)$_GET['file']; $sql = mysql_query("SELECT * FROM `files` WHERE `file_id` = {$file}"); if (mysql_num_rows($sql) != 1) { echo 'That file does not exist'; } else { $row = mysql_fetch_assoc($file); $path = "core/file/{$row['file_name']}"; header('Content-Type: application/octetstream'); header('Content-Type: application/octet-stream'); header('Content-Description: File Transfer'); header("Content-Disposition: attachment; filename=\"{$row['file_name']}\""); header('Content-Length: '.filesize($path)); readfile($path); } } ?>However, when I try to download a file, I get the option to download the file "download.php" which contains the errors:
<br /><b>Warning</b>: mysql_fetch_assoc() expects parameter 1 to be resource, integer given in <b>C:\xampp\htdocs\PHP\SQL\Download MOD\download.php</b> on line <b>12</b><br /> <br /> <b>Warning</b>: filesize() [<a href='function.filesize'>function.filesize</a>]: stat failed for core/file/ in <b>C:\xampp\htdocs\PHP\SQL\Download MOD\download.php</b> on line <b>20</b><br /> <br /> <b>Warning</b>: readfile(core/file/) [<a href='function.readfile'>function.readfile</a>]: failed to open stream: No such file or directory in <b>C:\xampp\htdocs\PHP\SQL\Download MOD\download.php</b> on line <b>22</b><br />What am I doing wrong?
Thanks.