Monday, 12 August 2013

PHP - Get file extension (image) without knowing it

PHP - Get file extension (image) without knowing it

How can I get the extension of an image file without knowing what it is? I
have tried using glob, as below, but it returns an error: "Array Notice:
Undefined offset: 0"
$path=BASEURL."content/images/profile_images/".$imageName;
$results= glob($path.'.*');
$filename = $results[0];
echo $filename;

No comments:

Post a Comment