CopyTo casuing 'Loading...' text to stay on screen

Last post 07-30-2009, 4:24 AM by cutechat. 10 replies.
Sort Posts: Previous Next
  •  07-27-2009, 6:29 AM 54295

    CopyTo casuing 'Loading...' text to stay on screen

    Hi,
     
    I'm testing out the Framework 2.0-VB-MagicAjax/simple-upload-Validation.aspx page.
     
    When I add in:

    args.CopyTo("c:\\temp\\" & args.FileName)

    I get the 'Loading...' message appear on the top right of the page, and there it stays. I can't right click on the page, I can't click on any buttons, the only thing I can do it click the 'Back' button in the browser.
     
    I'm trying to save the uploaded file to a folder on the site and then redirect to another page.

    Any ideas ?
    I'm using .net version 2.0 and this is my web.config file:
     
    <?xml version="1.0"?>
    <configuration>
        <appSettings>
        </appSettings>
        <system.web>
            <pages>
                <controls>
                    <add namespace="CuteWebUI" assembly="CuteWebUI.AjaxUploader" tagPrefix="CuteWebUI"/>
                    <add namespace="MagicAjax.UI.Controls" assembly="MagicAjax" tagPrefix="MagicAjax"/>
                </controls>
                <namespaces>
                    <add namespace="System.Collections.Generic"/>
                    <add namespace="System.IO"/>
                    <add namespace="System.Data"/>
                    <add namespace="System.Data.SqlClient"/>
                </namespaces>
            </pages>
            <compilation debug="true">
                <assemblies>
                    <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                </assemblies>
            </compilation>
            <httpHandlers>
                <remove verb="*" path="*.asmx"/>
                <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
                <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
                <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
            </httpHandlers>
            <httpModules>
                <add name="MagicAjax" type="MagicAjax.MagicAjaxModule, MagicAjax" />
                <add name="CuteWebUI.UploadModule" type="CuteWebUI.UploadModule,CuteWebUI.AjaxUploader"/>
            </httpModules>
        </system.web>
        <system.webServer>
            <modules>
                <remove name="MagicAjax"/>
                <add name="MagicAjax" type="MagicAjax.MagicAjaxModule, MagicAjax" />
                <remove name="CuteWebUI.UploadModule"/>
                <add name="CuteWebUI.UploadModule" type="CuteWebUI.UploadModule,CuteWebUI.AjaxUploader"/>
            </modules>
        </system.webServer>
    </configuration>

    Thanks
    James
  •  07-27-2009, 3:31 PM 54305 in reply to 54295

    Re: CopyTo casuing 'Loading...' text to stay on screen

    James,
     
    Please try the following example:
     
    1. <%@ Page language="c#"%>   
    2. <%@ Register Namespace="CuteWebUI" Assembly="CuteWebUI.AjaxUploader" TagPrefix="CuteWebUI" %>   
    3. <html>    
    4. <head>   
    5. </head>   
    6. <body>   
    7.     <form id="Form1" method="post" runat="server">   
    8.     <CuteWebUI:Uploader runat="server" MultipleFilesUpload="true" ID="Uploader1">   
    9.     </CuteWebUI:Uploader>    
    10.     </form>   
    11. </body>   
    12. </html>  
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  07-27-2009, 9:14 PM 54321 in reply to 54295

    Re: CopyTo casuing 'Loading...' text to stay on screen

    James,
     
    I think the server throws an exception , and the MagicAjax did not show it.
     
    If you do not use MagicAjax, I recommand you try another sample (NoAjax or MicrosoftAjax)
     
    Regards,
    Terry
  •  07-28-2009, 11:32 AM 54341 in reply to 54321

    Re: CopyTo casuing 'Loading...' text to stay on screen

    Hi Adam,
     
    Thanks for the code I managed to get the page to redirect after the upload, so that bit works.
     
    However, I need to change the width of the div that the progress text appears in as it appears over an image I have on the page:



    Also if a person cancels an upload I don't want a list to appear of the cancelled uploads as the list appears over another image:



    Can all that be done ?

    Thanks
    James
  •  07-28-2009, 1:59 PM 54349 in reply to 54341

    Re: CopyTo casuing 'Loading...' text to stay on screen

    James,
     
    Please use the following property:
     

    UploaderBase.ProgressPanelWidth Property

    The width of the Progress Panel. Default is 360.


    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  07-29-2009, 6:41 AM 54361 in reply to 54349

    Re: CopyTo casuing 'Loading...' text to stay on screen

    Hi,
     
    I've implemented that and it worked in a fashion. The progress box does get smaller but the text that appears below still stretches across my page instead of wrapping.
     
    Also, I want to hide the list of files that I've attempted to upload but then cancelled. How can I do that ?



    Thanks James
     
     
  •  07-30-2009, 2:17 AM 54394 in reply to 54361

    Re: CopyTo casuing 'Loading...' text to stay on screen

    Has anyone got any ideas ?
  •  07-30-2009, 2:35 AM 54395 in reply to 54394

    Re: CopyTo casuing 'Loading...' text to stay on screen

    Please check this sample code :
     
     
    1. <%@ Page Language="C#" Title="Total Progress" %>  
    2. <%@ Import Namespace="CuteWebUI" %>  
    3. <%@ Register TagPrefix="CuteWebUI" Namespace="CuteWebUI" Assembly="CuteWebUI.AjaxUploader" %>  
    4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">  
    5.   
    6. <script runat="server">  
    7.   
    8.     void InsertMsg(string msg)   
    9.     {   
    10.         ListBoxEvents.Items.Insert(0, msg);   
    11.         ListBoxEvents.SelectedIndex = 0;   
    12.     }   
    13.     protected void UploadAttachments1_AttachmentAdded(object sender, AttachmentItemEventArgs args)   
    14.     {   
    15.         InsertMsg("Added.." + args.Item.FileName);   
    16.     }   
    17.   
    18. </script>  
    19.   
    20. <html xmlns="http://www.w3.org/1999/xhtml">  
    21. <head id="Head1" runat="server">  
    22. </head>  
    23. <body>  
    24.     <form id="Form1" runat="server">  
    25.         <CuteWebUI:UploadAttachments runat="server" ID="UploadAttachments1" OnAttachmentAdded="UploadAttachments1_AttachmentAdded">  
    26.         </CuteWebUI:UploadAttachments>  
    27.         <div id='progressInfo' style="display:none;font-size:18px;color:DarkRed"></div>  
    28.         <br />  
    29.         <div>  
    30.             Server Trace:   
    31.             <br />  
    32.             <asp:ListBox runat="server" ID="ListBoxEvents" Width="800"></asp:ListBox>  
    33.         </div>  
    34.     </form>  
    35.     <script type="text/javascript">  
    36.     var uploader=document.getElementById('<%=UploadAttachments1.ClientID %>');   
    37.     function CuteWebUI_AjaxUploader_OnQueueUI(list)   
    38.     {   
    39.         if(list.length<2)return;   
    40.            
    41.         var errorcount=0;   
    42.         for(var i=0;i<list.length;i++)   
    43.         {   
    44.             var size=list[ i ].FileSize;    //or -1 if iframe mode   
    45.             var stat=list[ i ].Status;   
    46.                
    47.             if(stat=="Cancel"||stat=="Error")   
    48.                 errorcount++;   
    49.         }   
    50.         if(errorcount==list.length)   
    51.         {   
    52.             setTimeout(uploader.reset,1);   
    53.         }   
    54.     }   
    55.     </script>  
    56.   
    57. </body>  
    58. </html>  

     
    Regards,
    Terry
     
  •  07-30-2009, 3:42 AM 54399 in reply to 54395

    Re: CopyTo casuing 'Loading...' text to stay on screen

    Hi,

    Thanks for the code but the list still apears when I hit the Cancel button:

  •  07-30-2009, 3:59 AM 54400 in reply to 54399

    Re: CopyTo casuing 'Loading...' text to stay on screen

    Hi,
     
    I've finally fixed it with some code you posted:

    <script type="text/javascript">
        function CuteWebUI_AjaxUploader_OnQueueUI(items) {
            return false;
        }
    </script>

    Thanks James
  •  07-30-2009, 4:24 AM 54401 in reply to 54400

    Re: CopyTo casuing 'Loading...' text to stay on screen

    Hi,
     
    You can use if(list.length<1)return; 
     
    If you return false, the table will not show .
     
     
    Regards,
    Terry
View as RSS news feed in XML