Pass the resulting file to the getimagesize () function . If the file is an image (of a supported type), you will get an array with the image type, which is stored as the third element of the array. If the file is not the result of the image, there will be false.
source
share