<?php$filesize = $_FILES['userfile']['size'];$filetype = $_FILES['userfile']['type'];$type = substr($filetype, (strpos($filetype,"/"))+1);$types=array("jpeg","gif","png"); if ( $filesize > 0 && $filesize <= 100000 && in_array($type, $types) ) {// realizar acciones}else{echo "Imagen no valida!.";?>