我是通過文件在php.net link閱讀並沿着以下行來了:
$ _FILES [ 'userfile的'] [「型」]
The mime type of the file, if the browser provided this information. An example would be "image/gif". This mime type is however NOT checked on the PHP side and therefore don't take its value for granted.
那麼,如何將一個去核實該文件是一個適當的MIME類型,以阻止用戶上載可能有害的文件到服務器;或以其他方式導致代碼執行服務器端的錯誤(因爲我可能會試圖在一個不是JPEG格式的文件上使用僅用於jpeg的函數)?
在此先感謝