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

How to check if file is video type in php?

王林
Release: 2023-08-19 13:46:01
forward
1031 people have browsed it

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";
Copy after login

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 {
}
Copy after login

Example






Copy after login

This will produce the following output −

Output

The movie demo.mp4 is of video type.
Copy after login

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!

Related labels:
source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template