I am using the below script to validate if the uploaded files are png or jpeg but getting error message. please help.


PHP Code:
switch(exif_imagetype($_FILES[$photo]['name'])) {
    case 
IMAGETYPE_JPG:
    case 
IMAGETYPE_JPEG:
    case 
IMAGETYPE_PNG:
        break;
    default:
        echo 
"{";
        echo        
"error: 'This is no photo..'\n";
        echo 
"}";
        exit(
0);
    } 
The error message
Code:
Warning: exif_imagetype() [function.exif-imagetype]: Filename cannot be empty in test.php on line 52