Check Image file while uploading in php
by Mohan[ Edit ] 2014-02-18 14:08:06
<h1>Check Image file while uploading in php</h1>
While uploading an image on a site,there is a chance for malware in the image file,
This simple function checks whether the uploaded file is an image file or not.
If image file is uploaded,returns true else false.
<?php
function isImage($img){
return (bool)getimagesize($img);
}
$validimage=isImage(image_path);
?>