Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <tr>
- <asp:Label ID="lblFinLabel" runat="server" Text="Financial" CssClass="label"></asp:Label>
- <td colspan="2">
- <div style="float:left; width:250px">
- <asp:Label ID="lblFinReports" runat="server" Text="Financial" CssClass="label"></asp:Label>
- </div>
- <div style ="float:right;width:100px">
- <asp:UpdatePanel ID="UpdatePanel1" runat="server">
- <ContentTemplate>
- <asp:ScriptManager ID="SM2" runat="server"> </asp:ScriptManager>
- <ajaxToolkit:AsyncFileUpload ID="AFU2" runat="server" UploaderStyle="Modern" ClientIDMode="AutoID"
- OnClientUploadComplete="UploadComplete"
- OnClientUploadError="UploadError"
- OnUploadedComplete="AFUFinanicalReport_UploadedComplete"
- OnUploadedFileError="AFUFinanicalReport_UploadedFileError"/>
- <asp:Label ID="lblFinStatus" runat="server" ForeColor="#660033"></asp:Label>
- </ContentTemplate>
- </asp:UpdatePanel>
- </div>
- </td>
- </tr>
- <script type="text/javascript">
- function UploadComplete(sender)
- {
- $get("<%=lblFinStatus.ClientID%>").innerHTML = "File upload successfully";
- }
- function UploadError(sender)
- {
- $get("<%=lblFinStatus.ClientID%>").innerHTML = "File upload failed";
- }
- </script>
- <script runat="server">
- protected void AFUFinanicalReport_UploadedComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)
- {
- if (AFU2.HasFile)
- {
- String fileExt = System.IO.Path.GetExtension(AFU2.FileName);
- if (AFU2.PostedFile.ContentLength < 2048000)
- {
- string filename = System.IO.Path.GetFileName(AFU2.FileName);
- AFU2.SaveAs(Server.MapPath("~/Upload/Finanical Reports/") + lblPage1ID.Text + filename);
- lblFinStatus.Text = "The File uploaded";
- }
- else
- {
- lblFinStatus.Text = "The file type not accepted or more than 2MB";
- }
- }
- }
- protected void AFUFinanicalReport_UploadedFileError(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)
- {
- lblFinStatus.Text = "The file not upload";
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement