Note that there are some explanatory texts on larger screens.

plurals
  1. POUtility of HTTP header "Content-Type: application/force-download" for mobile?
    text
    copied!<p>I am currently working on a PHP script that allows you to download media contents (video, audio, pictures...) from your mobile device by accessing a link. (i.e. <a href="http://www.my-web-site.com/download.php?id=7ejs8ap">http://www.my-web-site.com/download.php?id=7ejs8ap</a>) My script worked very vell when I was testing it with recent mobile (Samsung Galaxy S, iPhone 4S, some others...) but an error occured on my old mobile Samsung C3050. The media I wanted to download was just an audio mp3 file that I usually download easily.</p> <p>The error appears to be "Unknown content type." So, as my only HTTP header Content-Type was "application/force-download", I try to comment this and try again. Then, it works. But now, I am currently asking what this Content-Type means and if it can be mandatory for others mobile. I tested without the Content-Type on the iPhone 4 and it works, but I'm not sure of this compatibility for all mobile.</p> <p>Can someone explain me how that Content-Type works, why this isn't a standard MIME or everything else that can help me to be sure this is an optionnal Content-Type for every download, whatever the file, the browser or the device I am downloading on?</p> <p>Thanks everyone.</p> <p>Here is my PHP headers sent:</p> <pre class="lang-php prettyprint-override"><code>&lt;?php //Assume that $filename and $filePath are correclty set. header('Content-Description: File Transfer'); header('Content-Disposition: attachment; filename="'.$filename.'"'); // header('Content-Type: application/force-download'); Non-standard MIME-Type, incompatible with Samsung C3050 for example. Let it commented readfile($filePath); ?&gt; </code></pre> <p>EDIT : I just tried with a Sony Xperia, and the download wasn't successful: I only see the "html-encoded" bytes of my file I want to download. How can I know what content-type I have to use if application/octet-stream or application/force-download doesn't work?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload