PHP Scripts Development » General Web Development Forum

PHP Force Downloading - readfile or readhell?

(2 posts)

Great offers not only for geeks!


  1. User has not uploaded an avatar

    lucid999
    Member

    Hi,

    No readfile function seems to work in IE for me. Does anyone have any idea why? The function I'm using is:

    function DownloadFile($file) { // $file = include path header('Content-Description: File Transfer');
    header('Content-Type: application/force-download');
    header('Content-Disposition: attachment; filename='.basename($file));
    header('Content-Transfer-Encoding: binary');
    header('Expires: 0');
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    header('Pragma: public');
    header('Content-Length: ' . filesize($file));
    ob_clean();
    flush();
    @readfile($file);
    exit;
    }

    DownloadFile($fullpath);

    The file will always be a zip around 30Mb. In firefox, the file will download perfectly. No issues. In IE 7, it will prompt to save or open and then download a file that is 0 bytes. Since others seems to be having success, is there a possible configuration issue?

    Some mentioned putting "session_cache_limiter()" or "session_start()" before the function. That didn't work either.

    Thanks for any help.

    Posted 2 months ago #
  2. I see a lot of code which make no sense (to me), do you tried one of the snippets from this thread?

    Posted 2 months ago #

RSS feed for this topic

Reply

You must log in to post.