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:
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.IO;
- using CuteWebUI;
-
- public partial class TestUploaderWithMaster : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {}
-
- protected void SubmitButton_Click(object sender, EventArgs e)
- {}
-
- protected void Uploader_FileUploaded(object sender, UploaderEventArgs args)
- {
- args.Delete();
- }
-
- protected override void OnPreRender(EventArgs e)
- {
- SubmitButton.Attributes["itemcount"] = Uploader.Items.Count.ToString();
-
- base.OnPreRender(e);
- }
- }
Here is my ASPX file:
- <%@ Page Title="" Language="C#" MasterPageFile="~/App_Master/Register.master" AutoEventWireup="true" CodeFile="TestUploaderWithMaster.aspx.cs" Inherits="TestUploaderWithMaster" %>
-
- <asp:Content ID="Content1" ContentPlaceHolderID="HeadPlaceholder" Runat="Server">
- </asp:Content>
- <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceholder" Runat="Server">
- <asp:ScriptManager ID="Scriptmanager" runat="server">
- </asp:ScriptManager>
-
- <asp:UpdatePanel ID="UpdatePanel" runat="server">
- <ContentTemplate>
- <h2>Select Video:</h2>
- <CuteWebUI:UploadAttachments runat="server" ManualStartUpload="true" ID="Uploader" UploadType="Flash"
- InsertText="Browse Files" OnFileUploaded="Uploader_FileUploaded" MultipleFilesUpload="false">
- <ValidateOption MaxSizeKB="102400" AllowedFileExtensions="wmv,flv,f4v,avi,mov,mpg,mpeg,avi" />
- </CuteWebUI:UploadAttachments>
-
- <div>
- <asp:Button runat="server" ID="SubmitButton" OnClientClick="return submitbutton_click()" Text="Submit" OnClick="SubmitButton_Click" />
- </div>
-
- <script type="text/javascript">
- 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;
- }
-
- function submitbutton_click()
- {
- var submitbutton = document.getElementById('<%=SubmitButton.ClientID %>');
- var uploadobj = document.getElementById('<%=Uploader.ClientID %>');
-
- if (!window.filesuploaded)
- {
- if (uploadobj.getqueuecount() > 0)
- {
- uploadobj.startupload();
- }
- else
- {
- var uploadedcount = parseInt(submitbutton.getAttribute("itemcount")) || 0;
- if (uploadedcount > 0)
- {
- return true;
- }
- alert("Please browse files for upload");
- }
- return false;
- }
- window.filesuploaded = false;
- return true;
- }
-
- function CuteWebUI_AjaxUploader_OnPostback()
- {
-
- window.filesuploaded = false;
- return false;
- }
-
- </script>
-
- </ContentTemplate>
- </asp:UpdatePanel>
- </asp:Content>
Finally, here is my web.config:
- <?xml version="1.0"?>
- <configuration>
- <system.web>
- <httpRuntime maxRequestLength="204800" executionTimeout="7200" />
-
- ....
-
- <pages>
- <controls>
- <add namespace="CuteWebUI" assembly="CuteWebUI.AjaxUploader" tagPrefix="CuteWebUI"/>
- </controls>
- </pages>
- </system.web>
- <system.webServer>
- <security>
- <requestFiltering>
- <requestLimits maxAllowedContentLength="204800000"></requestLimits>
- </requestFiltering>
- </security>
- <modules runAllManagedModulesForAllRequests="true">
- <add name="CuteWebUI.UploadModule" type="CuteWebUI.UploadModule,CuteWebUI.AjaxUploader" />
- </modules>
- </system.webServer>
-
- ....
-
- <appSettings>
- <!--<add key="CuteWebUI.AjaxUploader.UploadSpeedKB" value="90" />-->
- <add key="CuteWebUI.AjaxUploader.TempDirectory" value="V:\SomePath\UploadTemp"/>
- </appSettings>
- </configuration>
My problems are these:
- 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.
- 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.