Hi,

I have made a php script ware you can download some files, but it doesn't
work very well

After the first "echo fread($fc, 10240);" line it will send some strange
data

what to do?



      if (!($fc = fopen($path . $file, "rb"))) {
        echo "error\n";
        exit;
      }
      $file_size = filesize($path . $file);

      ob_end_clean();
      ignore_user_abort(false);

      if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')){
        // IE cannot download from sessions without a cache
        header('Cache-Control: public');
      }
      header("Content-type: application/octet-stream");
      header("Content-Disposition: attachment; filename=\"".$file."\"");
      header("Content-length: ".(string)($file_size));
      if ($description!="") {
          header("Content-Description: " . $description);
      }

      while(!feof($fc)) {
        set_time_limit(5);
        echo fread($fc, 10240);
        flush();
      }

      fclose($fc);
      exit;


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to