forum

Home / DeveloperSection / Forums / How to check if an ASP.Net File Upload Control has a file in JQuery?

How to check if an ASP.Net File Upload Control has a file in JQuery?

Anonymous User 2214 19-Jan-2015

So I'm writing a custom validator and I need to check if a file has been uploaded using the asp.net File Upload Control.

So far I have:

function validate(sender, args)
{
    if ($('#<%=hdnID.ClientID%>').val() != "False")
    {
        args.IsValid =true;
    }
    else
    {
        if ($('#<%=fup.ClientID %>').val() != '' )
        {
            alert("Run some code here");
        }
        else
        { }
    }
 }

The bit that is not right is

if ($('#<%= fup.ClientID %>').val() != '' )

I'm not sure how to determine whether the control has a file or not. Any suggestions would be awesome. Thanks.


Updated on 19-Jan-2015
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By