The method of processing images learned from the Internet, detecting forged images with modified suffix names:
<code>//检测伪造 public function checkFlag() { $this->flag=@getimagesize($this->fileInfo['tmp_name']); if ($this->flag) { return true; }else { $this->error="请上传合法文件"; return false; } }</code>
I would like to ask if there is a method similar to getimagesize to detect audio and video, MP3, MP4.
The method of processing images learned from the Internet, detecting forged images with modified suffix names:
<code>//检测伪造 public function checkFlag() { $this->flag=@getimagesize($this->fileInfo['tmp_name']); if ($this->flag) { return true; }else { $this->error="请上传合法文件"; return false; } }</code>
I would like to ask if there is a method similar to getimagesize to detect audio and video, MP3, MP4.
<code>$finfo = finfo_open(FILEINFO_MIME); $mimetype = finfo_file($finfo, $inputFileName);</code>
You can judge by reading the first 8 bytes.