Answered by : chinazamekpere-chimbo
//Where $file is an instance of Illuminate\Http\UploadFile
$extension = $file->getClientOriginalExtension();
Source : https://stackoverflow.com/questions/38403558/get-an-image-extension-from-an-uploaded-file-in-laravel/38403610 | Last Update : Sat, 25 Sep 21
Answered by : geeky-bravo
$ext = pathinfo($filename, PATHINFO_EXTENSION);
Source : https://stackoverflow.com/a/173876/212889 | Last Update : Mon, 02 Nov 20
Answered by : alex-fnssuyb99zxv
php -m
Source : | Last Update : Wed, 03 Mar 21
Answered by : code-grepper
$ext = pathinfo($_FILES["file"]["name"], PATHINFO_EXTENSION);
Source : | Last Update : Mon, 11 Nov 19
Answered by : jonathan-tisseau
// Here is a quick way of fetching only the filename (without extension) regardless of what suffix the file has.
// your file
$file = 'image.jpg';
$info = pathinfo($file);
// Before PHP 5.2
$file_name = basename($file, '.'.$info['extension']);
// After PHP 5.2
$file_name = $info['filename'];
Source : https://www.php.net/manual/fr/function.basename.php | Last Update : Wed, 14 Oct 20
Answered by : zwazel
<?php
echo filetype('/etc/passwd'); // file
echo filetype('/etc/'); // dir
?>
Source : https://www.php.net/manual/de/function.filetype.php | Last Update : Wed, 10 Feb 21
Answered by : amin-arjmand
//Get File Extension
function getFileExtension($fileName)
{ return '.' . strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
}
Source : | Last Update : Sat, 13 Aug 22
Answered by : cadoteu
$ext=pathinfo($file, PATHINFO_EXTENSION);
Source : | Last Update : Sat, 16 Oct 21