Why PHP method $mime = mime_content_type($filename); gives mime-type = application/zip for apk files?? I've defined apk mimetype in htaccess
.htaccess
<IfModule mod_mime.c>
AddType application/vnd.android.package-archive apk
AddType application/apk apk
AddType application/java-archive jar
</Ifmodule>
<FilesMatch \.apk$>
SetHandler application/vnd.android.package-archive
</FilesMatch>
I've tried all the solutions provided below but still none of them solved the problem. Need help regarding this.
That's because mime_content_type is not affected by .htaccess. However, the documentation specifies that you can set magic.mime file:
string mime_content_type ( string $filename )
Returns the MIME content type for a file as determined by using information from the
magic.mimefile.
There is also finfo_open (PECL) function that has $magic_file as a parameter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With