rubahfgouveia Posted October 18, 2010 Share Posted October 18, 2010 Hey, having some troblems using the readfile function.. I have the following code. I want to download the file "blabla.gif", but the file is in a certain directory (let's say: "/ExampleFile/Files/" . How do I set the path to "/ExampleFile/Files/" ? $file ='blabla.gif'; if (file_exists($file)) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename='.basename($file)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($file)); ob_clean(); flush(); readfile($file); exit; } Thanks, Ruben Quote Link to comment Share on other sites More sharing options...
Colton.Wagner Posted October 18, 2010 Share Posted October 18, 2010 Could it be as easy as: $file ='./ExampleFile/Files/blabla.gif'; I didn't even test it but I have used that before. Thanks, Colton Wagner Quote Link to comment Share on other sites More sharing options...
rubahfgouveia Posted October 18, 2010 Author Share Posted October 18, 2010 worked as a charm. thanks alot Quote Link to comment Share on other sites More sharing options...
Colton.Wagner Posted October 18, 2010 Share Posted October 18, 2010 Not a problem good luck with your endeavors! Thanks, Colton Wagner Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.