ou812 Posted December 12, 2009 Share Posted December 12, 2009 i'm hoping someone can point me to a server setting that needs to be changed in php.ini or httpd.conf (or some other place?) to solve a force download script problem i have with on a new server. i have a force download script that runs fine on the old server (and other servers i've used it on) with both Internet Explorer and other browsers, working example here: http://weightloss123.com/test/test.html both the 400K and 30K files download as expected in IE and other browsers, but on the new server ... http://www.foreclosureforcash.com/test/test.html in Internet Explorer, only the 30K file will download and the 400K download fails. my assumption is the script is good because it works on the old server and a number of other servers i've used it on in both IE and other browsers. for reference, here's an example of the working script: <?php session_start(); $download_dir = "/server/path/to/download/dir"; $file_path = $download_dir . DIRECTORY_SEPARATOR . $_GET['file']; $asfname = $_GET['file']; $fsize = filesize($file_path); $mtype = "application/force-download"; header("Pragma: public"); pre-check=0"); header("Expires: -1"); header("Cache-Control: no-cache"); header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Type: $mtype"); header("Content-Disposition: attachment; filename=\"$asfname\""); header("Content-Transfer-Encoding: binary"); header("Content-Length: " . $fsize); $file = @fopen($file_path,"rb"); if ($file) { while(!feof($file)) { print(fread($file, 1024*); flush(); if (connection_status()!=0) { @fclose($file); die(); } } @fclose($file); } ?> let me know if you can point me to a specific change or changes i might make to the setup of the new server to solve this problem. Thanks for your help ... -Chris Quote Link to comment https://forums.phpfreaks.com/topic/184917-server-settings-to-enable-force-download/ Share on other sites More sharing options...
cags Posted December 13, 2009 Share Posted December 13, 2009 Perhaps it's just a side effect of posting it on here, but it's not a valid script (which the highlighting clearly shows). I'd recommend looking into readfile, I'm not sure if it will solve your problem or not, but it would certainly seem easier. Quote Link to comment https://forums.phpfreaks.com/topic/184917-server-settings-to-enable-force-download/#findComment-976466 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.