What is the best way to determine whether or not a file is an image in PHP?

前端 未结 12 637
有刺的猬
有刺的猬 2021-01-22 07:25

I have a sever which people can upload files to. The problem is that some of the filenames are mangled (dont have any extension) and so I cannot immediately determine file type.

12条回答
  •  情书的邮戳
    2021-01-22 08:03

    For the first question is extension is known you could use the PHP function in_array() Documentation

提交回复
热议问题