Unsuccessful uploads

  •  03-16-2011, 11:53 AM

    Unsuccessful uploads

    Hello, I am currently testing out the AjaxUploader and have come across an issue.

    I have set up a test application which is shown below.

    <%@ Master Language="C#" AutoEventWireup="true" CodeFile="Site.master.cs" Inherits="Site" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <
    html xmlns="http://www.w3.org/1999/xhtml">
    <
    head id="head1" runat="server">
       <
    title>Title</title>
    </
    head>
    <
    body>
       <form id="form1" runat="server">
           <div>
             <asp:ScriptManager ID="ScriptManager1" runat="server" />
             <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server" />
          </div>
       </form>
    </
    body>
    </
    html>
     
    <%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" %>
    <asp:Content id="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script id="script" type="text/javascript">
       function Upload() {
          var uploadobj = document.getElementById('<%=Uploader1.ClientID %>');
          var count = uploadobj.getqueuecount();
          if (uploadobj.getqueuecount() > 0) {
             uploadobj.startupload();
          }
       }

     

       function CuteWebUI_AjaxUploader_OnQueueUI(list) {
          //return false can hide the queue table.
          return false;
       }
       function CuteWebUI_AjaxUploader_OnError(msg) {
          alert(
    "global error:" + msg);
          return false;
       }
       function CuteWebUI_AjaxUploader_OnTaskError(obj, msg, reason) {
          alert(
    "file error:" + obj.FileName + " , " + msg);
          return false;
       }
       </script>
       <div>
          <asp:UpdatePanel ID="UpdatePanel1" runat="server">
             <ContentTemplate>
                <
    asp:Button ID="UpdateButton" runat="server" OnClientClick="Upload()" Text="Upload" />
                <CuteWebUI:Uploader runat="server" ID="Uploader1" ManualStartUpload="true" />
             </ContentTemplate>
          </asp:UpdatePanel>
       </div>
    </
    asp:Content>

    web.config contains.
     
    <appSettings>
       <
    add key="CuteWebUI.AjaxUploader.TempDirectory" value="~/Temp"/>
    </
    appSettings>
     
    <controls>
       <add namespace="CuteWebUI" assembly="CuteWebUI.AjaxUploader" tagPrefix="CuteWebUI"/>
    </
    controls>
     
    <httpModules>
       <add name="CuteWebUI.UploadModule" type="CuteWebUI.UploadModule,CuteWebUI.AjaxUploader"/>
    </
    httpModules>

     
    In this example, occasionally the uploader will not upload the specified file and the CuteWebUI_AjaxUploader_OnTaskError(obj, msg, reason) function catches the error. 'msg' is undefined and 'reason' is either 'check' or 'unload'.

    In one of our products we have been testing the AjaxUploader and the errors are much more frequent. This issue seems to only occur when the uploader is inside an update panel. Can you help ?

    Regards

    Paul

    Filed under:
View Complete Thread