I have a link to download mp3 on all mobile device they can read them. I also have an Acer E320 with Android 2.3.4 and I want to download my mp3 by clicking my link (web server Apache; this is some PHP source behind that link).
I tried with a BlackBerry, and I got the file. I tried with my Firefox browser with a user-agent of a Samsung Galaxy S with Android, and I got the file. I tried with my Acer E320 with the same Android 2.3.4, and... I didn't get the file.
I am obviously sure that comes from the OS, I'll try with a Windows Phone tomorrow but I'm pretty sure this will works.
Here are my sources for the download:
<?php
// assume that all variables are correctly set
header("Pragma: public");
header("Expires: 0");
header("Cache-Control:");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Type: audio/mpeg");
header('Content-Disposition: attachment; filename="'.$filename.'";');
header("Content-Transfer-Encoding: binary");
header('Content-Range: ' . $download_range);
header('Content-Length: ' . $download_size);
readfile($filename);
?>
Thank you if you have any idea why this code doesn't work on an Android phone.
EDIT: I tried with an HTC with Windows Phone OS. The download didn't start but I can see my hit on the apache log... It seemes that Android is not alone...
2nd EDIT: I finnaly find it: there's a pre-fetch done with Android that kill my download because of a one-use token. Thanks all