www.webdeveloper.com
Results 1 to 2 of 2

Thread: Php validate image error message

  1. #1
    Join Date
    Dec 2008
    Posts
    135

    Php validate image error message

    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

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,432
    Assuming line 52 is the first line you showed us, then it would appear that $_FILES[$photo]['name'] is either not set or has an empty value; so you need to figure out why that is (misspelling, or $photo has an unexpected/incorrect value, etc.?).
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles