Home  >  Article  >  Backend Development  >  How to check if file is video type in php?

How to check if file is video type in php?

王林
王林forward
2023-08-19 13:45:25909browse

How to check if file is video type in php?

Let us assume that the following are our variables in which we have a .mp4 path file −

$movieFileType="demo.mp4";

To check if the above file is of video type, use end( ) and explode(). You need to set this condition in strtolower() and check the condition −

if(strtolower(end(explode(".",$movieFileType))) =="mp4") {
}
else {
}

Example






This will produce the following output −

Output

The movie demo.mp4 is of video type.

The above is the detailed content of How to check if file is video type in php?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete