duke_1222
11-19-2006, 05:27 PM
Hi there,
I have a simple uplaod script using ASP.NET
It works very well - but what I would like to do is disable the page whilst it is uploading BIG files.
Ideally, hide the uplaod button and state
"BUSY UPLOADING your file.. please be patient"
with a GIF showing.. :mad: - so users know the pager hasn't crashed
Do I need to use Javascript to do this dynamically or ASP.nET?
See code below:
<%@ Page Language="VB"%>
<script runat="server">
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
If FileUpload1.HasFile Then
Try
FileUpload1.SaveAs(Server.MapPath("../uploaded_folder/" & FileUpload1.FileName))
Label1.Text = "File name: " & _
FileUpload1.PostedFile.FileName & "<br>" & _
"File Size: " & _
FileUpload1.PostedFile.ContentLength
Catch ex As Exception
Label1.Text = "ERROR: " & ex.Message.ToString()
End Try
Else
Label1.Text = "You have not specified a file."
End If
End Sub
</script>
<form>
<asp:Button ID="Button1" runat="server" Text="Upload file Now" OnClick="Button1_Click" />
<asp:Label ID="Label1" runat="server" ForeColor="Red"></asp:Label>
</form>
Any comments will be greatly appreciated!
I have a simple uplaod script using ASP.NET
It works very well - but what I would like to do is disable the page whilst it is uploading BIG files.
Ideally, hide the uplaod button and state
"BUSY UPLOADING your file.. please be patient"
with a GIF showing.. :mad: - so users know the pager hasn't crashed
Do I need to use Javascript to do this dynamically or ASP.nET?
See code below:
<%@ Page Language="VB"%>
<script runat="server">
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
If FileUpload1.HasFile Then
Try
FileUpload1.SaveAs(Server.MapPath("../uploaded_folder/" & FileUpload1.FileName))
Label1.Text = "File name: " & _
FileUpload1.PostedFile.FileName & "<br>" & _
"File Size: " & _
FileUpload1.PostedFile.ContentLength
Catch ex As Exception
Label1.Text = "ERROR: " & ex.Message.ToString()
End Try
Else
Label1.Text = "You have not specified a file."
End If
End Sub
</script>
<form>
<asp:Button ID="Button1" runat="server" Text="Upload file Now" OnClick="Button1_Click" />
<asp:Label ID="Label1" runat="server" ForeColor="Red"></asp:Label>
</form>
Any comments will be greatly appreciated!