Hello, I have downloaded the AjaxFileUpload control 3.5 for the Async File Upload Control and it works perfectly in FF & Chrome. It does not work in IE. I've seen posts that say IE9+ is where it works correctly but I have tried it using IE8 on the following
URL and it works great too:
Taonias
Member
351 Points
276 Posts
Async File Upload Control
Nov 13, 2012 11:21 AM|LINK
Hello all
I need to use an async file upload control and place it in an ascx file which will be referenced in several pages.
This is the sample code i am working on:
ascx:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ucFileUpload.ascx.cs" Inherits="Test.UserControls.ucFileUpload" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> <script type="text/javascript" language="javascript"> function uploadError(sender,args) { document.getElementById('lblStatus').innerText = args.get_fileName(), "<span style='color:red;'>" + args.get_errorMessage() + "</span>"; } function StartUpload(sender,args) { document.getElementById('lblStatus').innerText = 'Uploading Started.'; } function UploadComplete(sender,args) { var filename = args.get_fileName(); var contentType = args.get_contentType(); var text = "Size of " + filename + " is " + args.get_length() + " bytes"; if (contentType.length > 0) { text += " and content type is '" + contentType + "'."; } document.getElementById('lblStatus').innerText = text; } </script> <div> <cc1:AsyncFileUpload ID="AsyncFileUpload1" runat="server" OnClientUploadError="uploadError" OnClientUploadStarted="StartUpload" OnClientUploadComplete="UploadComplete" CompleteBackColor="Lime" UploaderStyle="Modern" ErrorBackColor="Red" ThrobberID="Throbber" OnUploadedComplete="AsyncFileUpload1_UploadedComplete" UploadingBackColor="#66CCFF" Width="150px" /> </div> <div> <asp:Label ID="Throbber" runat="server" Style="display: none"> <img src="../Images/indicator.gif" align="middle" alt="loading" /> </asp:Label> </div> <div> <asp:Label ID="lblStatus" runat="server" Style="font-family: Arial; font-size: small;"></asp:Label> </div>cs:
protected void AsyncFileUpload1_UploadedComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e) { if (AsyncFileUpload1.HasFile) { string strPath = MapPath("~/Images/Dynamic/") + Path.GetFileName(e.FileName); AsyncFileUpload1.SaveAs(strPath); } AsyncFileUpload1.ClearAllFilesFromPersistedStore(); }If in the user control the file upload does not work.
I also need to clear the data of the file upload in order to allow users to upload more files without havind to restart the page.
Any suggestions?
Nasser Malik
Star
12546 Points
1867 Posts
Re: Async File Upload Control
Nov 13, 2012 11:27 AM|LINK
Try New AjaxFileUpload control. AjaxFileUpload is an ASP.NET Ajax control which enables you to upload multiple files to the server asynchronously.
http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/AjaxFileUpload/AjaxFileUpload.aspx
Skype: maleknasser1
Taonias
Member
351 Points
276 Posts
Re: Async File Upload Control
Nov 13, 2012 01:53 PM|LINK
Thanks for the reply.
I will test that.
Is there a way of achiving what i asked?
Kandake
Member
2 Points
1 Post
Re: Async File Upload Control
Nov 13, 2012 06:16 PM|LINK
Hello, I have downloaded the AjaxFileUpload control 3.5 for the Async File Upload Control and it works perfectly in FF & Chrome. It does not work in IE. I've seen posts that say IE9+ is where it works correctly but I have tried it using IE8 on the following URL and it works great too:
http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/AjaxFileUpload/AjaxFileUpload.aspx
Is there something else I am missing in order to achieve the same functionality as the above site on IE <9?
chetan.sarod...
All-Star
66619 Points
11270 Posts
Re: Async File Upload Control
Nov 14, 2012 04:24 AM|LINK
Refer this similar thread -
http://forums.asp.net/t/1604041.aspx/1
Senior Software Engineer,
Approva Systems Pvt Ltd, Pune, India.