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

  •  10-26-2010, 7:39 PM

    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. 
View Complete Thread