mime type in document module

Where does Documents get the mime type to be related to file?
I have files with extensions .m .nb .wl .cdf which are mapping to text/plain instead of their proper mime-types:

.nb application/vnd.wolfram.mathematica

.cdf application/vnd.wolfram.cdf.text

.m and .wl application/vnd.wolfram.mathematica.package

 

thank you,

FrancescaS

Parents
  • Hello FrancescaS,

    Usually it is managed in include/uplloadfile.php with a method getMime or something like that which calls a function get_file_mime_type (and lot of others) in include/utils/file_utils.php.

    Hope that can help you.

  • thank you Cédric.

    include/upload_file.php has a function confirm_upload() which in turn uses getMime to set the mime type.

    getMime uses the function get_file_mime_type in include/utils/file_utils.php

    the mime type comes from:

                $finfo = finfo_open(FILEINFO_MIME_TYPE);

                if ($finfo) {

                    $mime = @finfo_file($finfo, $file);

                    finfo_close($finfo);

                }

     

    and is therefore using php and apache to get the mime but it doesn't map the right one.

     

    I get application/zip for .docx

    and text/plain for .nb and other such extensions.

     

    I think I'll have to move this issue to my apache admins.

     

    thank you for setting me on the right track once again.

    Francesca

     

Reply
  • thank you Cédric.

    include/upload_file.php has a function confirm_upload() which in turn uses getMime to set the mime type.

    getMime uses the function get_file_mime_type in include/utils/file_utils.php

    the mime type comes from:

                $finfo = finfo_open(FILEINFO_MIME_TYPE);

                if ($finfo) {

                    $mime = @finfo_file($finfo, $file);

                    finfo_close($finfo);

                }

     

    and is therefore using php and apache to get the mime but it doesn't map the right one.

     

    I get application/zip for .docx

    and text/plain for .nb and other such extensions.

     

    I think I'll have to move this issue to my apache admins.

     

    thank you for setting me on the right track once again.

    Francesca

     

Children
No Data