Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Okay, I figured out a work-around. The problem was coming from the readfile() function since it sends the file to the output buffer. I just disabled output buffering (call ob_end_clean();) before the code runs:

    ob_end_clean();
    header("Pragma: public");
    header("Expires: 0");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header( "Cache-Control: private", false);
    header("Content-Type: application/force-download");
    header("Content-Type: application/octet-stream");
    header("Content-Type: application/download");
    header('Content-Disposition: attachment; filename="'.$file_name.'";');
    header("Content-Transfer-Encoding: binary");
    $filesize = filesize($full_filename);
    if ($filesize != 0)
    header("Content-Length: ".$filesize);
    ob_clean();
    flush();
    readfile($full_filename);
    exit;

    Almost forgot:
    Wordpress 3.5.1
    W3TC 0.9.2.11

    I get the same error when I enable any part of W3TC (page caching, DB caching, etc.). The problem only appears when downloading an MP3 using our download plugin. When someone downloads an MP3, the resulting file does not contain MP3 data but the following text:

    <br />
    <b>Fatal error</b>:  Unknown: Cannot use output buffering in output buffering display handlers in <b>Unknown</b> on line <b>0</b><br />

    Here’s the crucial snippet from our download plugin. Is there any way to disable caching for pages served by this plugin. It’s keyed to a trailing “folder” on the url called “/download-audio”

    header("Pragma: public");
    			header("Expires: 0");
    			header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    			header( "Cache-Control: private", false);
    			header("Content-Type: application/force-download");
    			header("Content-Type: application/octet-stream");
    			header("Content-Type: application/download");
    			header('Content-Disposition: attachment; filename="'.$file_name.'";');
    			header("Content-Transfer-Encoding: binary");
    			$filesize = filesize($full_filename);
    			if ($filesize != 0)
    				header("Content-Length: ".$filesize);
    			ob_clean();
        		flush();
    			readfile($full_filename);
    			exit;
Viewing 3 replies - 1 through 3 (of 3 total)