Hi carlpr,
Please try the example below, it require the user at least select a file for upload.
- <%@ Page Language="C#" %>
-
- <%@ Register Namespace="CuteWebUI" Assembly="CuteWebUI.AjaxUploader" TagPrefix="CuteWebUI" %>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head id="Head1" runat="server">
- <title>Start uploading manually</title>
- <link rel="stylesheet" href="demo.css" type="text/css" />
- </head>
- <body>
- <form id="form1" runat="server">
- <CuteWebUI:UploadAttachments runat="server" ManualStartUpload="true" ID="Uploader1"
- InsertText="Browse Files (Max 1M)">
- <ValidateOption MaxSizeKB="1024" />
- </CuteWebUI:UploadAttachments>
- <p>
- <asp:Button runat="server" ID="SubmitButton" Text="Submit" OnClientClick="return submitbutton_click()" />
- </p>
- <script type="text/javascript">
-
- function submitbutton_click() {
- var submitbutton = document.getElementById('<%=SubmitButton.ClientID %>');
- var uploadobj = document.getElementById('<%=Uploader1.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 uploading");
- }
- return false;
- }
- window.filesuploaded = false;
- return true;
- }
- function CuteWebUI_AjaxUploader_OnPostback() {
- window.filesuploaded = true;
- var submitbutton = document.getElementById('<%=SubmitButton.ClientID %>');
- submitbutton.click();
- return false;
- }
- </script>
-
- </div>
- </form>
- </body>
- </html>
Regards,
Ken