<%@ Page Title="Manual Upload" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" %>
<%@ Register Assembly="AjaxUploader" Namespace="AjaxUploader.Controls" TagPrefix="au" %> 
<asp:Content ID="TitleContent" ContentPlaceHolderID="TitleContent" runat="server">Manual Upload - AjaxUploader v5.2 Demos</asp:Content>
<asp:Content ID="HeaderContent" ContentPlaceHolderID="HeaderTitle" runat="server">Manual Upload</asp:Content> 
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server"> 
<div class="demo-card"> <div class="demo-card-header">Manual Upload</div> <div class="demo-card-body"> <p class="demo-description"> Set <code>AutoUpload="false"</code> to let users review their selected files before
 uploading. A separate upload button allows them to start when ready.
 </p> <au:AjaxFileUpload ID="Uploader1" runat="server"
 AllowMultiple="true"
 AutoUpload="false"
 ButtonText="Select Files"
 ShowProgress="true" /> <button type="button" id="startUploadBtn" class="btn btn-primary mt-2"> Start Upload
 </button> <div id="manualStatus" class="mt-2 text-muted" role="status" aria-live="polite"></div> <div class="code-panel"> <pre><code>&lt;au:AjaxFileUpload ID="Uploader1" runat="server"
 AllowMultiple="true"
 AutoUpload="false"
 ButtonText="Select Files"
 ShowProgress="true" /&gt;

&lt;button id="startUploadBtn" type="button"&gt;
 Start Upload
&lt;/button&gt;

var startButton = document.getElementById('startUploadBtn');
if (startButton) {
 startButton.addEventListener('click', function () {
  var uploader = AjaxUploader.getInstance('Uploader1');
  if (uploader) uploader.startUpload();
 });
}</code></pre> </div> </div>
</div> 
</asp:Content>
<asp:Content ID="ScriptsContent" ContentPlaceHolderID="ScriptsContent" runat="server">
<script>
 (function () {
 var startButton = document.getElementById('startUploadBtn');
 var status = document.getElementById('manualStatus');
 if (!startButton) return;
 startButton.addEventListener('click', function () {
 var uploader = window.AjaxUploader && typeof AjaxUploader.getInstance === 'function' ? AjaxUploader.getInstance('Uploader1') : null;
 if (uploader) {
 if (status) status.textContent = 'Starting manual upload...';
 if (typeof uploader.startUpload === 'function') uploader.startUpload();
 } else if (status) {
 status.textContent = 'Uploader is still loading. Try again in a moment.';
 }
 });
 })();
</script>
</asp:Content>
