Ken,
The method above you provided does not really work. It does seem to upload the file and fire OnUploadCompleted and OnFileUploaded events. However, the ajax part of uploader does not work as it generates a full page postback.. I am using the code you gave me below within an updatepanel. It works fine when i debug with VS2010 on my local machine. However, when i publish the code to my production test server it fails.. My production test server also requires i don't use <httpModules> in the web.config and use the <system.webServer> config.
<script type="text/javascript">
function submitbutton_click() {
alert("submitbutton_click");
var submitbutton = document.getElementById('<%=SubmitButton.ClientID %>');
var uploadobj = document.getElementById('<%=FileUploader1.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() {
alert("OnPostBack");
window.filesuploaded = true;
var submitbutton = document.getElementById('<%=SubmitButton.ClientID %>');
submitbutton.click();
return false;
}
</script>
<
asp:UpdatePanel ID="UploadPanel" class="window" ClientIDMode="Static" ChildrenAsTriggers="true" UpdateMode="Conditional" runat="server" >
<ContentTemplate>
<CuteWebUI:Uploader ID="FileUploader1" ClientIDMode="Static" MaxFilesLimit="1" runat="server" InsertButtonID='Uploader1Insert' ProgressCtrlID='Uploader1Progress' CancelButtonID='Uploader1Cancel' TempDirectory="~/UploaderTemp" ProgressPanelWidth="300" InsertText="Select Image" onuploadcompleted="Uploader1_UploadCompleted" onfileuploaded="Uploader1_FileUploaded" >
<ValidateOption AllowedFileExtensions=".png,.jpg,.bmp,.jpeg,.gif, ," />
<ValidateOption MaxSizeKB="1164" />
</CuteWebUI:Uploader>
<asp:Image runat="server" ID="Uploader1Insert" AlternateText="Upload File" ImageUrl="../Images/upload.png" Style="float:left; margin:0px;" /><br />
<asp:Panel runat="server" ID="Uploader1Progress" BorderColor="Orange" BorderStyle="dashed" BorderWidth="2" Style="float:left; margin:0px; padding:0px; ">
<asp:Label ID="Uploader1ProgressText" runat="server" ForeColor="Firebrick"></asp:Label><br />
</asp:Panel><br />
<asp:Image runat="server" ID="Uploader1Cancel" AlternateText="Upload File" ImageUrl="../Images/cancel.png" /> <br />
<asp:Button runat="server" ID="SubmitButton" OnClientClick="return submitbutton_click()" Text="Submit" style="display:none;" />
</
ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="SaveButton" EventName="Click" />
</asp:UpdatePanel>