PHP: Explode file extension | Malaysia Mari


 //example: basename($_FILES['file']['name'][$i] = angry_birds.jpg

$extension = explode(".", basename($_FILES['file']['name'][$i]));
$getExtension = count($extension) -1;
$extension = strtolower($extension[$getExtension]);

if($extension != "jpg" && $extension != "jpeg")
{
echo "only .jpg or .jpeg file";
}
echo $extension;


The output:
-------------------------
jpg
-------------------------

Full code will publish later. thanks


Popular Posts

.

Sila Klik, Untuk  Menempah Web Profesional!
Facebook Page
Facebook Page
Back to Top