get the value of input type file , and alert if empty

Viewed 105980

how to alert if input type file is empty !?

this is my jquery code but i didnt know how to get the value

$('.upload').live("click",function()
{
    var imgVal = $('#uploadImage').val();
    if(imgVal=='')
    {
        alert("empty input file");

    }
    return false;

});


<input type="file" name="image" id="uploadImage" size="30" />
<input type="submit" name="upload"  class="send_upload" value="upload" />
3 Answers

There should be

$('.send_upload')

but not $('.upload')

Related