the $fpath is dependent on the filename from the database.. if you go to http://uploadian.com/files/1319619466/356-ucon.png.html look on the bottom i have debugged where it is located and it is correct.. the debug outputs inside the function after setting $path function download($fpath) { $path = realpath($fpath); header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Length: ' . filesize($path)); header('Content-Disposition: attachment; filename=' . basename($path)); readfile($path); } $files->download($fpath);