
Untitled
By: a guest on
May 14th, 2012 | syntax:
None | size: 1.19 KB | hits: 15 | expires: Never
Button doesn't fire event when filename not exist on firefox
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void UploadButton_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
{
UploadStatusLabel.Text = "Your file wasn't saved. It's a test.";
}
else
{
// Notify the user that a file was not uploaded.
UploadStatusLabel.Text = "You did not specify a file to upload.";
}
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>FileUpload Example</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h4>
Select a file to upload:</h4>
<asp:FileUpload ID="FileUpload1" runat="server"></asp:FileUpload>
<br />
<br />
<asp:Button ID="UploadButton" Text="Upload file" OnClick="UploadButton_Click" runat="server">
</asp:Button>
<hr />
<asp:Label ID="UploadStatusLabel" runat="server">
</asp:Label>
</div>
</form>
</body>
</html>