Skip to content
Advertisement

how to check if a file is either a video type, image type or a document type in php

I am trying to perform an action if a certain file is of a certain type; image, video or document.

What I have tried so far:

if(preg_match("/.(mp4|mov)$/", $filename)) and

JavaScript

None of the above work and the ISSUE is mainly on identifying the video type

full code:

JavaScript

reference: Check file extension in upload form in PHP

Advertisement

Answer

Try use mime_content_type.

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement