<%@ Page Title="Single File Upload (VB.NET)" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="true" %>
<%@ Register Assembly="AjaxUploader" Namespace="AjaxUploader.Controls" TagPrefix="au" %>
<script runat="server">
    Protected Sub Uploader1_FileUploaded(ByVal sender As Object, ByVal e As AjaxUploader.Events.FileUploadedEventArgs)
        ' Same API, VB.NET syntax - every sample in this DemoApp translates the same way.
        Dim savedName As String = Guid.NewGuid().ToString("N") &
            System.IO.Path.GetExtension(If(e.FileName, ""))
        Dim svc As New AjaxUploader.Services.UploadService()
        svc.CopyFile(e.FileGuid, "~/uploads/" & savedName)
        lblSaved.Text = "Saved <code>" & Server.HtmlEncode(e.FileName) &
            "</code> to <code>~/uploads/" & savedName & "</code> (" & e.FileSize & " bytes)"
    End Sub
</script>
<asp:Content ID="TitleContent" ContentPlaceHolderID="TitleContent" runat="server">Single File Upload (VB.NET) - AjaxUploader v5.2 Demos</asp:Content>
<asp:Content ID="HeaderContent" ContentPlaceHolderID="HeaderTitle" runat="server">Single File Upload - VB.NET</asp:Content>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<div class="demo-card"> <div class="demo-card-header">The complete save pattern, in VB.NET</div> <div class="demo-card-body">
 <p class="demo-description"> Identical to the C# Single File demo, in VB.NET. The control, events and services are the
 same assembly - only the language syntax differs, and it does so mechanically for every sample in this DemoApp. </p>
 <div class="demo-expect"><strong>What you should see:</strong> select a file and it uploads, posts back automatically, and the green strip names the saved path under <code>~/uploads</code> - the same zero-click flow as the C# version.</div>
 <au:AjaxFileUpload ID="Uploader1" runat="server"
     ButtonText="Select a File"
     AutoUpload="true"
     AutoPostBack="true"
     OnFileUploaded="Uploader1_FileUploaded"
     ShowProgress="true" />
 <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 and it is saved to ~/uploads automatically." /></div>
 <div class="code-panel"> <pre><code>&lt;au:AjaxFileUpload ID="Uploader1" runat="server"
    AutoUpload="true"
    AutoPostBack="true"
    OnFileUploaded="Uploader1_FileUploaded" /&gt;

Protected Sub Uploader1_FileUploaded(ByVal sender As Object,
        ByVal e As AjaxUploader.Events.FileUploadedEventArgs)
    Dim svc As New AjaxUploader.Services.UploadService()
    svc.CopyFile(e.FileGuid, "~/uploads/" &amp; e.FileName)
End Sub</code></pre> </div>
</div> </div>
</asp:Content>
