Get the extension of file using PHP

By using this PHP code snippet you can get the extension of any file.


									<?php

$file = "/images/sample.jpg";
$fileInfo = pathinfo($file);
$ext = $fileInfo["extension"];

// Example:
echo $ext;

?>
								

coding-ninja

A dream without a plan is just a wish.

Comments (0)

No Comments Yet.