Jump to content

Recommended Posts

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

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.