AsyncFileUpload Control

Discussion in 'ASP.NET / ASP.NET Core' started by adlafb, May 18, 2011.

  1. We've used the Ajax Toolkit AsyncFileUpload control successfully on several of our DiscountASP.NET sites, successfully until the rollout of IE 9. Microsoft acknowledged some issues with the control and released a new version of their Toolkit .dll addressing these concerns. We are still unable to upload files using this control even with the new version 3.5 .dll. Our code performs perfectly on a development server but does not upload a file on our DiscountASP.Net server. No errors are thrown on the production server, but a file is not uploaded. No other Toolkit controls appear to be broken.

    Is anyone successfully using this control in IE 9 or Firefox under ASP.Net 2.0, 3.0 or 3.5 SP1? If so, how might we tweak our existing code?

    Thanks in advance.
     
  2. It was my understanding that the new release last week fixed this, and other bugs.
    Are you sure you are using the most recent version?
    If so let me know and I'll run some tests with it on IIS7.
     
  3. AsyncFileUpload

    Thanks for your message.

    Yes, it is the most recent version.
     
  4. OK, I'll play around with it and let you know what I find.
     
  5. AsyncFileUpload

    Thanks again.

    It appears the onUploadedComplete event does not fire in this implementation.

    <%@ Page Language="VB" %>
    <%@ Import Namespace="System.IO" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <script runat="server">
    Protected Sub page_load(ByVal sender As Object, ByVal e As EventArgs)
    End Sub

    Protected Sub upComplete(ByVal sender As Object, ByVal e As AsyncFileUploadEventArgs)
    Dim savePath As String = MapPath("~/images/" & Path.GetFileName(e.filename))
    file1.SaveAs(savePath)
    savePath = Nothing
    End Sub
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
    <title>Upload File</title>
    <script type="text/javascript" language="javascript">
    function uploadError(sender, args) {
    document.getElementById('lblStatus').innerHTML = args.get_fileName();
    };

    function uploadStart(sender, args) {
    document.getElementById('lblStatus').innerHTML = 'Upload Started....';
    };

    function uploadComplete(sender, args) {
    var filename = args.get_fileName();
    document.getElementById('lblStatus').innerHTML = "Upload Completed";
    };
    </script>
    </head>
    <body>
    <form id="Form1" runat="server">
    <cc1:ToolkitScriptManager runat="server" ID="Man1" EnablePartialRendering="true" />
    <br />
    <cc1:AsyncFileUpload ID="file1" runat="server" OnClientUploadStarted="uploadStart" OnUploadedComplete="upComplete" OnClientUploadComplete="uploadComplete" OnClientUploadError="uploadError"
    UploaderStyle="Modern" Width="275px" />
    <div id="lblStatus" style="font-family:Arial; font-size:small; color:Red"></div>
    </form>
    </body>
    </html>
     
  6. ...I'm going to run some extended tests with it in the morning but what I did find just now is the control does not work properly in IE9 unless you run it in compatibility mode.
    I didn't test it in Firefox but it did work in Chrome.
    More tomorrow...
     
  7. Question: Would you be open to trying some other File Upload component?
    I like the AjaxControlToolkit for a lot of things but this thing is whack. ;-)
     
  8. Seems the control stores the payload in session state, so the default value of 'false' must apply in the sessionstate tag of the web.config file in order for the control to function properly.

    <sessionState cookieless="false" timeout="xxx" ....... ........... .......... />

    This must be a change from earlier iterations of the Ajax Toolkit component, as our apps using the AsyncFileUpload control worked correctly with cookieless set to 'true'.

    Any observations?
     
  9. I'd ask on codeplex and see if anyone will help with that.
    Maybe even the asp.net forum for it but I think a thread on codeplex would be better.
     

Share This Page