PHP Mime Type for apk files

Why the PHP method $mime = mime_content_type($filename); gives mime-type = application/zip for apk files? I 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 tried all the solutions below, but still none of them solved the problem. Need help with this.

+5
source share
1 answer

This is because mime_content_type does not affect .htaccess . However, the documentation indicates that you can install the magic.mime file:

string mime_content_type (string $ filename)

Returns the MIME content type of the file, determined using the information from the magic.mime file.

There is also a finfo_open (PECL) function that takes $magic_file as a parameter.

+3
source

Source: https://habr.com/ru/post/1241380/


All Articles