How to get MIME type of a file in PHP 5.5?

前端 未结 8 1917
鱼传尺愫
鱼传尺愫 2020-11-30 07:10

I am using mime_content_type() in PHP 5.5 to get a MIME type, but it throws fatal: error function not found.

How can I achieve this on PHP

8条回答
  •  半阙折子戏
    2020-11-30 07:43

    Get the image size using:

    $infFil=getimagesize($the_file_name);

    and

    echo $infFil["mime"]
    

    The getimagesize returns an associative array which have a MIME key and obviously the image size too

    I used it and it works

提交回复
热议问题