PHP: File download doesnt download expected file

This question already has an answer here:

  • Proper MIME media type for PDF files 3 answers

  • $filename = './images/upload/'.$mongoDbA['file'];
    
        $fileinfo = pathinfo($filename);
        $sendname = $fileinfo['filename'] . '.' . $fileinfo['extension'];
    
        header('Content-Type: application/pdf');
        header('Content-Disposition: attachment; filename="$sendname"');
        header('Expires: 0');
        header('Cache-Control: must-revalidate');
        header('Pragma: public');
        header('Content-Length: ' . filesize($filename));
        readfile($filename);
        exit;
    
    链接地址: http://www.djcxy.com/p/8174.html

    上一篇: 使用PHP上传DOC或PDF

    下一篇: PHP:文件下载不下载预期的文件