---
title: "How to check if an ASP.Net File Upload Control has a file in JQuery?"  
description: "How to check if an ASP.Net File Upload Control has a file in JQuery?"  
author: "Anonymous User"  
published: 2015-01-19  
updated: 2015-01-19  
canonical: https://www.mindstick.com/forum/12878/how-to-check-if-an-asp-dot-net-file-upload-control-has-a-file-in-jquery  
category: "asp.net"  
tags: ["c#", "jquery"]  
reading_time: 1 minute  

---

# How to check if an ASP.Net File Upload Control has a file in JQuery?

So I'm [writing](https://www.mindstick.com/articles/12997/5-essential-tips-on-resume-writing-for-business-analysts) a [custom](https://www.mindstick.com/blog/12298/use-custom-writing-services-to-get-through-the-finals) [validator](https://www.mindstick.com/forum/156905/what-is-data-annotation-validator-attribute-in-asp-dot-net-mvc) and I need to [check if](https://www.mindstick.com/forum/160320/how-you-can-check-if-an-element-exists-in-a-set-and-add-or-remove-elements-from-it) a file has been uploaded using the [asp.net](https://www.mindstick.com/articles/934/default-folders-available-inside-the-asp-dot-net-application-folder) File [Upload Control](https://www.mindstick.com/forum/34649/how-can-use-file-upload-control-in-mvc).

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](https://www.mindstick.com/forum/161622/how-do-you-determine-whether-a-file-is-locked-or-in-use-by-another-process) the control has a file or not. Any suggestions would be awesome. Thanks.

## Replies

### Reply by Anonymous User

**This might not be the JQuery-est way of doing** it, but I've had success with something like this:

```
var uploader = $get("<%= fup.ClientID%>");if (uploader.value != "") {   //has files}
```

I also usually check that uploader != null before checking the value. Hope that helps!


---

Original Source: https://www.mindstick.com/forum/12878/how-to-check-if-an-asp-dot-net-file-upload-control-has-a-file-in-jquery

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
