Unsuccessful uploads

Last post 03-17-2011, 8:08 AM by Jeff. 3 replies.
Sort Posts: Previous Next
  •  03-16-2011, 11:53 AM 66692

    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:
  •  03-16-2011, 9:01 PM 66706 in reply to 66692

    Re: Unsuccessful uploads

    Hi Paul,
     
     I tested the AjaxUploader as your same config and page code under IE9,Chrome,Firefox 
    My IIS version is  IIS 7 
    it works fine.
    Can you tell me your application environment about IIS and Asp.net version?
     
    My test code is shown below
     
    1. <html xmlns="http://www.w3.org/1999/xhtml">  
    2. <head runat="server">  
    3.     <title></title>  
    4.     <script id="script" type="text/javascript">  
    5.         function Upload() {  
    6.             var uploadobj = document.getElementById('<%=Uploader1.ClientID %>');  
    7.             var count = uploadobj.getqueuecount();  
    8.             if (uploadobj.getqueuecount() > 0) {  
    9.                 uploadobj.startupload();  
    10.             }  
    11.         }  
    12.   
    13.   
    14.         function CuteWebUI_AjaxUploader_OnQueueUI(list) {  
    15.             //return false can hide the queue table.  
    16.             return false;  
    17.         }  
    18.         function CuteWebUI_AjaxUploader_OnError(msg) {  
    19.             alert("global error:" + msg);  
    20.             return false;  
    21.         }  
    22.         function CuteWebUI_AjaxUploader_OnTaskError(obj, msg, reason) {  
    23.             alert("file error:" + obj.FileName + " , " + msg);  
    24.             return false;  
    25.         }  
    26.     </script>  
    27. </head>  
    28. <body>  
    29.     <form id="form1" runat="server">  
    30.     <asp:ScriptManager ID="ScriptManager1" runat="server">  
    31.     </asp:ScriptManager>  
    32.     <div>  
    33.         <asp:UpdatePanel ID="UpdatePanel1" runat="server">  
    34.             <ContentTemplate>  
    35.                 <asp:Button ID="UpdateButton" runat="server" OnClientClick="Upload()" Text="Upload" />  
    36.                 <CuteWebUI:Uploader runat="server" ID="Uploader1" ManualStartUpload="true" />  
    37.             </ContentTemplate>  
    38.         </asp:UpdatePanel>  
    39.     </div>  
    40.     </form>  
    41. </body>  
    42. </html>  
     
    1. <appSettings>  
    2.         <add key="CuteWebUI.AjaxUploader.TempDirectory" value="~/Temp"/>  
    3. </appSettings>  
    4.   
    5. <system.web>  
    6.     <httpModules>  
    7.         <add name="CuteWebUI.UploadModule" type="CuteWebUI.UploadModule,CuteWebUI.AjaxUploader"/>  
    8.     </httpModules>  
    9.  </system.web>  
    10.   
    11.   
    12. <system.webServer>  
    13. <modules>  
    14.         <remove name="CuteWebUI.UploadModule" />  
    15.   
    16.           <add name="CuteWebUI.UploadModule" type="CuteWebUI.UploadModule,CuteWebUI.AjaxUploader"/>  
    17.       </modules>  
    18. </system.webServer>  
     
     Please download the latest version of AjaxUploader and ref the 'Framework 2.0-Csharp-MicrosoftAjax' demo.
     
    Regards,
    Jeff 
     
  •  03-17-2011, 4:23 AM 66711 in reply to 66706

    Re: Unsuccessful uploads

    I have tested this issue on IE versions 7 and 8, Chrome and FireFox and can produce the issue on all. The machine running the app is running Windows 7 with IIS version 7.5 and is using .NET Framework 3.5.
     
    I also noticed your example doesnt use a .master file and the ScriptManager should be contained within it.
     
     
    Additionally, I have noticed that when using FF and Chrome, if I cancel an upload I also get this error.
     
    Regards
     
    Paul
  •  03-17-2011, 8:08 AM 66715 in reply to 66711

    Re: Unsuccessful uploads

    Dear Paul,

    Did you give the Temp folder permissions to 'Network Service' group ?


    Please send the MasterPage, TestPage, Web.config and AjaxUploader.dll to me,

    I'll test it again under Windows 7 and Asp.net 3.5


    Regards,

    [email protected]

View as RSS news feed in XML