php force download extension

前端 未结 2 727
臣服心动
臣服心动 2021-01-27 10:28

I\'m trying to force a download so this is my code:

$file = \'test.m4r\';
$mime = \'audio/aac\';
header(\"Pragma: public\"); // required
header(\"Expires: 0\");          


        
2条回答
  •  轮回少年
    2021-01-27 10:57

    You can lie about the mimetype, but besides that there isn't anything you can do. Try:

    "application/octet-stream"

    This might work, and is the default for unknown filetypes etc.

提交回复
热议问题