• 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
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.
 
Found answer: Android tablet will not tolerate spaces in the attached filename. If I remove them using php on the server the tablet saves the file as AIRFORPIPES.MP3 correctly. Note: a Droid 2.3.6 phone works natively as it converts the spaces to underscores!
 
Back
Top Bottom