Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 14th, 2012  |  syntax: None  |  size: 1.19 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Button doesn't fire event when filename not exist on firefox
  2. <%@ Page Language="C#" %>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <script runat="server">
  5.  
  6.     protected void UploadButton_Click(object sender, EventArgs e)
  7.     {
  8.         if (FileUpload1.HasFile)
  9.         {
  10.             UploadStatusLabel.Text = "Your file wasn't saved. It's a test.";
  11.         }
  12.         else
  13.         {
  14.             // Notify the user that a file was not uploaded.
  15.             UploadStatusLabel.Text = "You did not specify a file to upload.";
  16.         }
  17.     }
  18. </script>
  19. <html xmlns="http://www.w3.org/1999/xhtml">
  20. <head id="Head1" runat="server">
  21.     <title>FileUpload Example</title>
  22. </head>
  23. <body>
  24.     <form id="form1" runat="server">
  25.     <div>
  26.         <h4>
  27.             Select a file to upload:</h4>
  28.         <asp:FileUpload ID="FileUpload1" runat="server"></asp:FileUpload>
  29.         <br />
  30.         <br />
  31.         <asp:Button ID="UploadButton" Text="Upload file" OnClick="UploadButton_Click" runat="server">
  32.         </asp:Button>
  33.         <hr />
  34.         <asp:Label ID="UploadStatusLabel" runat="server">
  35.         </asp:Label>
  36.     </div>
  37.     </form>
  38. </body>
  39. </html>