<%@ Page Title="Minimal Setup" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" %>
<%@ Register Assembly="AjaxUploader" Namespace="AjaxUploader.Controls" TagPrefix="au" %> 
<script runat="server">
    // This starter page deliberately saves to a real, persistent folder so the
    // upload-to-disk result is easy to inspect on the server. App_Data is not served
    // by IIS, which keeps this public demo from exposing arbitrary uploaded files.
    protected void Uploader1_FileUploaded(object sender, AjaxUploader.Events.FileUploadedEventArgs e)
    {
        var folder = Server.MapPath("~/App_Data/DemoSaves/MinimalSetup");
        System.IO.Directory.CreateDirectory(folder);

        var storedName = System.Guid.NewGuid().ToString("N")
            + System.IO.Path.GetExtension(e.FileName ?? string.Empty);
        var savedPath = System.IO.Path.Combine(folder, storedName);
        new AjaxUploader.Services.UploadService().CopyFile(e.FileGuid, savedPath);

        lblSaved.Text = "Saved <code>" + Server.HtmlEncode(e.FileName) + "</code> as <code>"
            + Server.HtmlEncode(storedName) + "</code> in <code>App_Data/DemoSaves/MinimalSetup</code>.";
    }
</script>
<asp:Content ID="TitleContent" ContentPlaceHolderID="TitleContent" runat="server">Minimal Setup - AjaxUploader v5.3 Demos</asp:Content>
<asp:Content ID="HeaderContent" ContentPlaceHolderID="HeaderTitle" runat="server">Minimal Setup</asp:Content> 
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server"> 
<div class="demo-card"> <div class="demo-card-header">Minimal Setup</div> <div class="demo-card-body"> <p class="demo-description"> The absolute minimum code required to add a working file upload to your page.
 Just one server control is all you need.
 </p>
 <div class="demo-expect"><strong>What you should see:</strong> select a file, then the page confirms it was saved to <code>App_Data/DemoSaves/MinimalSetup</code>. The folder is real and persistent, but IIS does not serve <code>App_Data</code>.</div> <au:AjaxFileUpload ID="Uploader1" runat="server" OnFileUploaded="Uploader1_FileUploaded" /> <div class="alert alert-success py-2 px-3 small mt-3" role="status"><asp:Label ID="lblSaved" runat="server" Text="Nothing saved yet. Select a file to upload it and write a permanent server-side copy." /></div> <div class="code-panel"> <pre><code>&lt;%@ Register Assembly="AjaxUploader" Namespace="AjaxUploader.Controls" TagPrefix="au" %&gt;

&lt;au:AjaxFileUpload ID="Uploader1" runat="server"
    OnFileUploaded="Uploader1_FileUploaded" /&gt;

protected void Uploader1_FileUploaded(object sender,
    AjaxUploader.Events.FileUploadedEventArgs e)
{
    var name = Guid.NewGuid().ToString("N")
        + Path.GetExtension(e.FileName ?? "");
    new AjaxUploader.Services.UploadService().CopyFile(e.FileGuid,
        Server.MapPath("~/App_Data/DemoSaves/MinimalSetup/" + name));
}</code></pre> </div> <h5 class="mt-4">What Happens Behind the Scenes</h5> <ol> <li>The server control renders a styled file input with upload button</li> <li>When a file is selected, it is uploaded via AJAX to the handler URL</li> <li>The completion event copies it into a permanent folder on the server</li> <li>The page confirms the stored filename after its automatic postback</li> </ol> </div>
</div> 
</asp:Content>
