Newbie questions and issues: Firefox compatibility, FileUploaded not being executed

Last post 10-27-2010, 11:53 AM by nokturnal. 2 replies.
Sort Posts: Previous Next
  •  10-26-2010, 7:39 PM 64713

    Newbie questions and issues: Firefox compatibility, FileUploaded not being executed

    I have some questions and concerns regarding Ajax Uploader.  My company is interested in this product, but before I can endorse it, I require some answers to some key questions.
     
    I have setup a common scenario:  a page which has a masterpage, that requires an upload control.  The site uses forms authentication and is IIS7 running in integrated mode.  We are currently using the demo of Ajax Uploader.
     
    Heres is my code behind file for the page:
     
    1. using System;  
    2. using System.Collections.Generic;  
    3. using System.Linq;  
    4. using System.Web;  
    5. using System.Web.UI;  
    6. using System.Web.UI.WebControls;  
    7. using System.IO;  
    8. using CuteWebUI;  
    9.   
    10. public partial class TestUploaderWithMaster : System.Web.UI.Page  
    11. {  
    12.     protected void Page_Load(object sender, EventArgs e)  
    13.     {}  
    14.   
    15.     protected void SubmitButton_Click(object sender, EventArgs e)  
    16.     {}  
    17.   
    18.     protected void Uploader_FileUploaded(object sender, UploaderEventArgs args)  
    19.     {  
    20.         args.Delete();  
    21.     }  
    22.   
    23.     protected override void OnPreRender(EventArgs e)  
    24.     {  
    25.         SubmitButton.Attributes["itemcount"] = Uploader.Items.Count.ToString();  
    26.   
    27.         base.OnPreRender(e);  
    28.     }  
    29. }  
     
    Here is my ASPX file:
     
    1. <%@ Page Title="" Language="C#" MasterPageFile="~/App_Master/Register.master" AutoEventWireup="true" CodeFile="TestUploaderWithMaster.aspx.cs" Inherits="TestUploaderWithMaster" %>  
    2.   
    3. <asp:Content ID="Content1" ContentPlaceHolderID="HeadPlaceholder" Runat="Server">  
    4. </asp:Content>  
    5. <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceholder" Runat="Server">  
    6.         <asp:ScriptManager ID="Scriptmanager" runat="server">  
    7.         </asp:ScriptManager>  
    8.   
    9.         <asp:UpdatePanel ID="UpdatePanel" runat="server">  
    10.             <ContentTemplate>  
    11.                 <h2>Select Video:</h2>  
    12.                 <CuteWebUI:UploadAttachments runat="server" ManualStartUpload="true" ID="Uploader" UploadType="Flash"  
    13.                     InsertText="Browse Files" OnFileUploaded="Uploader_FileUploaded" MultipleFilesUpload="false">  
    14.                     <ValidateOption MaxSizeKB="102400" AllowedFileExtensions="wmv,flv,f4v,avi,mov,mpg,mpeg,avi" />  
    15.                 </CuteWebUI:UploadAttachments>  
    16.   
    17.                 <div>  
    18.                     <asp:Button runat="server" ID="SubmitButton" OnClientClick="return submitbutton_click()" Text="Submit" OnClick="SubmitButton_Click" />  
    19.                 </div>  
    20.   
    21.                 <script type="text/javascript">  
    22.                     function CuteWebUI_AjaxUploader_OnError(msg)  
    23.                     {  
    24.                         alert("global error:" + msg);  
    25.                         return false;  
    26.                     }  
    27.   
    28.                     function CuteWebUI_AjaxUploader_OnTaskError(obj, msg, reason)  
    29.                     {  
    30.                         alert("file error:" + obj.FileName + " , " + msg);  
    31.                         return false;  
    32.                     }  
    33.                       
    34.                     function submitbutton_click()  
    35.                     {  
    36.                         var submitbutton = document.getElementById('<%=SubmitButton.ClientID %>');  
    37.                         var uploadobj = document.getElementById('<%=Uploader.ClientID %>');  
    38.   
    39.                         if (!window.filesuploaded)  
    40.                         {  
    41.                             if (uploadobj.getqueuecount() > 0)  
    42.                             {  
    43.                                 uploadobj.startupload();  
    44.                             }  
    45.                             else  
    46.                             {  
    47.                                 var uploadedcount = parseInt(submitbutton.getAttribute("itemcount")) || 0;  
    48.                                 if (uploadedcount > 0)  
    49.                                 {  
    50.                                     return true;  
    51.                                 }  
    52.                                 alert("Please browse files for upload");  
    53.                             }  
    54.                             return false;  
    55.                         }  
    56.                         window.filesuploaded = false;  
    57.                         return true;  
    58.                     }  
    59.   
    60.                     function CuteWebUI_AjaxUploader_OnPostback()  
    61.                     {  
    62.                         // Hide that window that shows the remove options  
    63.                         window.filesuploaded = false;  
    64.                         return false;  
    65.                     }  
    66.                       
    67.                 </script>  
    68.   
    69.             </ContentTemplate>  
    70.         </asp:UpdatePanel>  
    71. </asp:Content>  
    Finally, here is my web.config: 
     
    1. <?xml version="1.0"?>  
    2. <configuration>  
    3.   <system.web>  
    4.     <httpRuntime maxRequestLength="204800" executionTimeout="7200"  />  
    5.   
    6. ....  
    7.   
    8.     <pages>  
    9.       <controls>  
    10.         <add namespace="CuteWebUI" assembly="CuteWebUI.AjaxUploader" tagPrefix="CuteWebUI"/>  
    11.       </controls>  
    12.     </pages>  
    13.   </system.web>  
    14.   <system.webServer>  
    15.     <security>  
    16.       <requestFiltering>  
    17.         <requestLimits maxAllowedContentLength="204800000"></requestLimits>  
    18.       </requestFiltering>  
    19.     </security>  
    20.     <modules runAllManagedModulesForAllRequests="true">  
    21.       <add name="CuteWebUI.UploadModule" type="CuteWebUI.UploadModule,CuteWebUI.AjaxUploader" />  
    22.     </modules>  
    23.   </system.webServer>  
    24.   
    25. ....  
    26.   
    27.   <appSettings>  
    28.     <!--<add key="CuteWebUI.AjaxUploader.UploadSpeedKB" value="90" />-->  
    29.     <add key="CuteWebUI.AjaxUploader.TempDirectory" value="V:\SomePath\UploadTemp"/>  
    30.   </appSettings>  
    31. </configuration>  
     
     
    My problems are these: 
     
    1.  Notice I have hardcoded the uploader to use the UploadType of "Flash".  In auto mode while in Firefox, nothing happens when I click the "Browse Files" button.  I am assuming that is an issue with Silverlight.  All other browsers seem to function as they should.
    2. Second issue is that in the code behind you will notice I am calling args.Delete() within the Uploader_FileUploaded method.  The file is not being deleted.  I have tried using CopyTo and MoveTo and those are not being called either.  Bottomline, I don't think the Uploader_FileUploaded method is ever getting called and thus it's code isn't being executed.
    I have a lot more questions regarding Forms Authentication and passing extra information, but I will ask specific questions regarding those after I get answers to these issues.
     
    Cheers in advance. 
  •  10-26-2010, 10:24 PM 64714 in reply to 64713

    Re: Newbie questions and issues: Firefox compatibility, FileUploaded not being executed

    Hi nokturnal,
     
    Question 1
     
    Can you try our demo http://www.ajaxuploader.com/Demo/select-multiple-files-upload.aspx with your firefox browser?
     
    Is that works for you? What version of your firefox/flash/silverlight?
     
    Question 2
     
    Please try the example below. the method FileUploaded should fire after each file uploaded.
     
    1. <%@ Page Language="C#" %>  
    2.   
    3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
    4.   
    5. <script runat="server">  
    6.    
    7.     protected void UploadAttachments1_FileUploaded(object sender, UploaderEventArgs args)  
    8.     {  
    9.         label1.Text += args.FileName;  
    10.         label1.Text += "---";  
    11.     }  
    12. </script>  
    13.   
    14. <html xmlns="http://www.w3.org/1999/xhtml">  
    15. <head runat="server">  
    16.     <title>Untitled Page</title>  
    17. </head>  
    18. <body>  
    19.     <form id="form1" runat="server">  
    20.         <asp:Label ID="label1" runat="server"></asp:Label>  
    21.         <CuteWebUI:UploadAttachments ID="UploadAttachments1" runat="server" OnFileUploaded="UploadAttachments1_FileUploaded">  
    22.         </CuteWebUI:UploadAttachments>  
    23.     </form>  
    24. </body>  
    25. </html>  
    If you have more questions, you can contact me by mail directly.
     
     
    Regards,
     
    Ken 
  •  10-27-2010, 11:53 AM 64732 in reply to 64714

    Re: Newbie questions and issues: Firefox compatibility, FileUploaded not being executed

    Please see the email I have sent you.
     
    Thanks 
View as RSS news feed in XML