php get filetype
snippet in php

get image extension in php

user8583

//get image extension of uploaded file in php
$imagetype = $_FILES['image']['name'];
$ext = pathinfo($imagetype, PATHINFO_EXTENSION);// get file extension

php get filetype

user8341

<?php
echo filetype('/etc/passwd');  // file
echo filetype('/etc/');        // dir
?>