Jump to content

[SOLVED] header function doesn't work


genu

Recommended Posts

Hi, i've been working on a function to fetch and "mp3" from a server, and display the "Download" dialog in order to download it.

 

it looks like this:

 

    header("HTTP/1.1 200 OK");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Expires: 0");
    header("Content-Length: ".$filesize);
    header("Content-Type: application/force-download");
    header("Content-Disposition: attachment; filename=".$filename);
    header("Content-Transfer-Encoding: binary");

 

Basically, I'm trying to avoid the mp3 to open with the default player. That function works that it opens the download dialog. The problem is that the file is 0bytes after download.

 

Am I missing something?

Link to comment
https://forums.phpfreaks.com/topic/131522-solved-header-function-doesnt-work/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.