How can I determine a file's true extension/type programmatically?

前端 未结 11 1333
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-01 17:06

I am working on a script that will process user uploads to the server, and as an added layer of security I\'d like to know:

Is there a way to detect a file\'s true e

11条回答
  •  时光说笑
    2020-12-01 17:47

    Is checking the MIME type simply enough? I am assuming that changing the extension on a file doesn't change it's MIME type?

    Is MIME type a strong enough indicator to go by here?

    Thanks for all of the responses thus far.

提交回复
热议问题