PDF视图在Firefox中不再工作


PDF View no longer works in Firefox

我正在尝试查看PDF。这段代码过去可以在Firefox中工作。现在,只要语句头("Content-Type: $ctype");,则下载该文件。在它之后不会执行die()语句。发生了什么事?我用的是Firefox 20.0.1。

更新:解决-见下文

    if (file_exists($fullfilename)){
        // Parse Info / Get Extension
        $fsize = filesize($fullfilename);
        $path_parts = pathinfo($fullfilename);
        $ext = strtolower($path_parts["extension"]);
        // Determine Content Type
        switch ($ext) {
            case "pdf": $ctype="application/pdf"; break;
            case "exe": $ctype="application/octet-stream"; break;
            case "zip": $ctype="application/zip"; break;
            case "doc": $ctype="application/msword"; break;
            case "xls": $ctype="application/vnd.ms-excel"; break;
            case "ppt": $ctype="application/vnd.ms-powerpoint"; break;
            case "gif": $ctype="image/gif"; break;
            case "png": $ctype="image/png"; break;
            case "jpeg":
            case "jpg": $ctype="image/jpg"; break;
        // video
            case "3gp": $ctype='video/3gpp'; break;
                            case "3g2": $ctype='video/3g2'; break;
                            case "avi": $ctype='video/avi'; break;
                            case "mp4": $ctype='video/mp4'; break;
                            case "ogv": $ctype='video/ogg'; break;
                            case "mov": $ctype='video/quicktime'; break;            
            default: $ctype="application/force-download";
        }
        header("Pragma: public"); // required
        header("Expires: 0");
        header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
        header("Cache-Control: private",false); // required for certain browsers
        header("Content-Type: $ctype");
        if ($mode == "view"){
            // View file
            header('Content-Disposition: inline; filename='.basename($fullfilename));
        } 
        else {
            // Download file
            header('Content-Disposition: attachment; filename='.basename($fullfilename));
        }
        header("Content-Transfer-Encoding: binary");
        header("Content-Length: ".$fsize);
        if (ob_get_length() > 0 ) {
         //ob_end_clean();
                    ob_clean();
                    flush();
        }
        readfile( $fullfilename );              
    } 
    else {
        die('File Not Found: ' . $fullfilename);
    }

我不知道Firefox应用程序的PDF设置是如何更改为"下载"而不是"查看"的。现在固定。