rrayner Posted June 25, 2012 Share Posted June 25, 2012 I have the following code thanks to php.net which downloads a file from the server and I was wondering if you can force it to download into a certain directory? <?php $file = '317.txt'; 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'); header('Pragma: public'); header('Content-Length: ' . filesize($file)); ob_clean(); flush(); readfile($file); exit; } ?> Thanks Rob. Link to comment https://forums.phpfreaks.com/topic/264728-force-a-file-to-a-certain-directory-when-downloading/ Share on other sites More sharing options...
requinix Posted June 25, 2012 Share Posted June 25, 2012 I was wondering if you can force it to download into a certain directory? Nope. Link to comment https://forums.phpfreaks.com/topic/264728-force-a-file-to-a-certain-directory-when-downloading/#findComment-1356769 Share on other sites More sharing options...
rrayner Posted June 25, 2012 Author Share Posted June 25, 2012 Thanks Link to comment https://forums.phpfreaks.com/topic/264728-force-a-file-to-a-certain-directory-when-downloading/#findComment-1356776 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.