Click here to Skip to main content
15,880,469 members
Articles / Web Development / ASP.NET

ASP.NET - Upload File With Loading Image using JavaScript and C#

Rate me:
Please Sign up or sign in to vote.
4.38/5 (16 votes)
18 Mar 2009CPOL2 min read 100.9K   4.4K   43  
ASP.NET - Upload File with Loading Image appears after Start Uploading
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="FileUpload.aspx.cs" Inherits="FileUploadWithProgressBar.FileUpload" %>

<!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>Untitled Page</title>

    <script type="text/javascript" src="../JavaScript/Loading.js"></script>

</head>
<body>
    <form id="form1" runat="server">
    <asp:Panel ID="pnlUpload" runat="server">
        <div style="height: 80px;">
            <asp:Label ID="lblWelcomeMessage" runat="server" Text="Please select your file to upload it"
                Font-Size="11px" Font-Names="'Lucida Grande',Verdana,Arial,Sans-Serif" ForeColor="#555555"></asp:Label>
                <br /><br />
            <asp:FileUpload ID="FileUpload1" runat="server" />
        </div>
        <div style="height: 30px;">
            <asp:Button ForeColor="#FFFFFF" BackColor="#00cc00" OnClientClick="ShowProgress();"
                Text="Upload Your File" ID="btnUpload" runat="server" OnClick="btnUpload_Click" />
        </div>
    </asp:Panel>
    <asp:Panel ID="pnlAfterUpload" runat="server" Visible="false">
        <asp:Label ID="lblMessage" Text="Your File Has Been Successfully Saved" ForeColor="Red"
            runat="server"></asp:Label>
    </asp:Panel>
    </form>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer Readify
Australia Australia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions