PHP Outputting File Attachments with Headers

后端 未结 2 1678
不知归路
不知归路 2020-12-18 08:00

After reading a few posts here I formulated this function which is sort of a mishmash of a bunch of others:

function outputFile( $filePath, $fileName, $mimeT         


        
相关标签:
2条回答
  • 2020-12-18 08:21

    Not sure if this is the real answer, but I think you intended

    header('Content-Type: ' . $mimeType);
    

    to be

    header('Content-Type: ' . $mimeTypes[$mimeType]);
    
    0 讨论(0)
  • 2020-12-18 08:26

    Ok, I figured it out.

    The script above DOES work.

    What was happening is I had a series of include_once files, and one of them had a blank line causing the issue.

    0 讨论(0)
提交回复
热议问题