• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

HTTP Header filename ignored

DreamU

Lurker
Feb 3, 2012
3
1
I maintain a store which allows people to download mp3s they have purchased. The URL they enter to download the mp3 is of the form:

domainName/download.php?a=123&b=456 (forum won't let me post the URL)

Here is a typical header which my php program sends to the browser (captured with Fiddler):

Cache-Control: must-revalidate, post-check=0, pre-check=0
Content-Type: audio/mpeg
Content-Length: 3011430
Content-Disposition: attachment;filename="AIR FOR PIPES.MP3";

On an Android tablet, either pre 4.0 or post 4.0, the downloaded file is called "download.php", not "AIR FOR PIPES.MP3". In other words the browser ignores the attachment filename.

This code works fine on IE, Firefox, Chrome and Safari. It is only the Android browser, including the Chrome beta, which ignores the filename.

Other sites have suggested I must have no space after the ";" and mp3 must be in caps - neither is the solution. Other information suggests this is a known bug with POST but as you can see I am doing only GET. I have also tried specifying "application/octet-stream" but it makes no diff.

Apologies if this has been answered but the search feature is not working for me on this site.
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones