Check Image file while uploading in php

by Mohan 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);
?>
883
like
0
dislike
0
mail
flag

You must LOGIN to add comments