samoht Posted June 22, 2009 Share Posted June 22, 2009 Hello all I have a download.php file with this code: <?php $Login = $_REQUEST['login']; switch($_REQUEST['file']) { case 'SurgimapSetup.exe' : $myFile = 'SurgimapSetup.exe'; $filelocation = 'nsis/' . $Login . '/' . $myFile; header("Content-Length: " . filesize($filelocation)); header("Content-type: application/exe"); header("Content-Disposition: inline; filename=\"" . $myFile . "\";"); break; default: break; } ?> and I provide a simple link as such: <a href = "surgimap_api/download.php?login='.$name.'&file=SurgimapSetup.exe" > for some reason it says that I am downloading "SurgimapSetup.exe" - but the file size is 0?? I know the correct file exists... what am I doing wrong? thanks, Quote Link to comment Share on other sites More sharing options...
volatileboy Posted June 22, 2009 Share Posted June 22, 2009 have you tried using an absolute path to the file, ie: home/user/public_html/folder/etc/etc/file.exe Quote Link to comment Share on other sites More sharing options...
flyhoney Posted June 22, 2009 Share Posted June 22, 2009 you need to add readfile($filelocation); <?php $Login = $_REQUEST['login']; switch($_REQUEST['file']) { case 'SurgimapSetup.exe' : $myFile = 'SurgimapSetup.exe'; $filelocation = 'nsis/' . $Login . '/' . $myFile; header("Content-Length: " . filesize($filelocation)); header("Content-type: application/exe"); header("Content-Disposition: inline; filename=\"" . $myFile . "\";"); readfile($fileLocation); break; default: break; } Quote Link to comment Share on other sites More sharing options...
samoht Posted June 22, 2009 Author Share Posted June 22, 2009 thanks flyhoney! That did the trick 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.