Implementing upload progress indicator question


Marko Vuksanovic

I used the following code for implementing a file upload progress indicator, using UpdateProgress Panel, though I have a problem that FileUpload.Has File always returns false. Any suggestions what might be wrong?


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="FileUpload2.aspx.cs" Inherits="FileUpload2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="" >
<head id="Head1" runat="server">
<title> drag </title>


<form id="f1" enctype="multipart/form-data" runat="server">
<h4>Select a file to upload:</h4>

<atlas:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" />
<atlas:UpdatePanel ID="upResults" runat="server" Mode="conditional">
<atlas:ControlEventTrigger ControlID="Upload" EventName="Click" />

<asp:FileUpload id="FileUpload" runat="server"> </asp:FileUpload>

<br /><br />

<asp:Button id="Upload" Text="Upload file" OnClick="UploadButton_Click" runat="server">
<atlas:UpdateProgress ID="uprProgress" runat="server">

<img src="images/animated_loading.gif" /> Uploading....



using .....;

public partial class FileUpload2 : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)

protected void UploadButton_Click(object sender, EventArgs e)
// Specify the path on the server to save the uploaded file to.
String savePath = @"C:\Temp\uploads\";
// Before attempting to perform operations on the file, verify that the FileUpload control contains a file.
if (FileUpload.HasFile)
String fileName = FileUpload.FileName;
savePath += fileName;
// Call the SaveAs method to save the uploaded file to the specified path.
// Notify the user of the name of the file was saved under.
// UploadStatusLabel.Text = "Your file was saved as " + fileName;
// Notify the user that a file was not uploaded.
// UploadStatusLabel.Text = "You did not specify a file to upload.";

Any suggestions what might be wrong?

Marko Vuksanovic.


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question