---
title: "FileUpload.HasFile() always null"  
description: "FileUpload.HasFile() always null"  
author: "Anonymous User"  
published: 2014-09-03  
updated: 2014-09-03  
canonical: https://www.mindstick.com/forum/2245/fileupload-hasfile-always-null  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 1 minute  

---

# FileUpload.HasFile() always null

This is the [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) I use for my [UpdatePanel](https://www.mindstick.com/articles/151/asp-dot-net-ajax-server-control-updateprogress-updatepanel).

The FileUploadAsync.HasFile() is always null.

I am wondering what is [wrong](https://answers.mindstick.com/qa/48468/who-wrote-the-the-wrong-enemy-america-in-afghanistan-2001-2014-and-when) with my [asp.net](https://www.mindstick.com/articles/934/default-folders-available-inside-the-asp-dot-net-application-folder) [page](https://www.mindstick.com/articles/13031/why-to-make-a-wikipedia-page) ...

```
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="Server" /><asp:UpdatePanel ID="UpdatePanelAddFiles"runat="server" UpdateMode="Conditional">    <Triggers>       
<asp:AsyncPostBackTrigger ControlID="LkUpload" />    </Triggers>   
<ContentTemplate>    <asp:LinkButton ID="LkUpload" runat="server" OnClick="LkUpload_Click"
Visible="false">Upload</asp:LinkButton>        <ajaxToolkit:AsyncFileUpload runat="server" ID="FileUploadAsync" />   
</ContentTemplate></asp:UpdatePanel>
```

## Replies

### Reply by Sumit Kesarwani

Hi Pravesh, \

```
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="futest.aspx.cs" Inherits="erpweb.futest" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server">   
<title></title></head><body>    <form id="form1" runat="server">    <div>   
<asp:ScriptManager ID="smTest" runat="server"></asp:ScriptManager>   
<asp:UpdatePanel ID="upTest" runat="server">       
<ContentTemplate>           
<ajaxToolkit:AsyncFileUpload ID="AsyncFileUpload1" runat="server"                
onuploadedcomplete="AsyncFileUpload1_UploadedComplete" />       
</ContentTemplate>   
</asp:UpdatePanel>    </div>    </form></body></html>
```

## codebehind:

```
    protected void AsyncFileUpload1_UploadedComplete(object sender,
AjaxControlToolkit.AsyncFileUploadEventArgs e)    {        if(AsyncFileUpload1.HasFile)        {            //do save process here        }    }
```


---

Original Source: https://www.mindstick.com/forum/2245/fileupload-hasfile-always-null

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
