<%@ Page Title="Multiple Files (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)
        ' Fires once per uploaded file on the postback (AutoPostBack="true").
        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)
        litSaved.Text &= "<li><code>" & Server.HtmlEncode(If(e.FileName, "file")) &
            "</code> &rarr; <code>~/uploads/" & savedName & "</code> (" & e.FileSize & " bytes)</li>"
    End Sub
</script>
<asp:Content ID="TitleContent" ContentPlaceHolderID="TitleContent" runat="server">Multiple Files (VB.NET) - AjaxUploader v5.3 Demos</asp:Content>
<asp:Content ID="HeaderContent" ContentPlaceHolderID="HeaderTitle" runat="server">Multiple File Upload - VB.NET</asp:Content>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<div class="demo-card"> <div class="demo-card-header">Multiple files, saved per-file, in VB.NET</div> <div class="demo-card-body">
 <p class="demo-description"> <code>AllowMultiple="true"</code> plus <code>AutoPostBack="true"</code>: the whole batch uploads,
 the page posts back once, and <code>FileUploaded</code> fires once per file - each handled in VB. </p>
 <div class="demo-expect"><strong>What you should see:</strong> select several files at once; when the batch finishes the page posts back automatically and the list below names each saved file under <code>~/uploads</code>.</div>
 <au:AjaxFileUpload ID="Uploader1" runat="server"
     AllowMultiple="true"
     ButtonText="Select Multiple Files"
     AutoUpload="true"
     AutoPostBack="true"
     ShowProgress="true"
     OnFileUploaded="Uploader1_FileUploaded" />
 <ul class="small mt-3"><asp:Literal ID="litSaved" runat="server" /></ul>
 <div class="code-panel"> <pre><code>&lt;au:AjaxFileUpload ID="Uploader1" runat="server"
    AllowMultiple="true"
    AutoUpload="true"
    AutoPostBack="true"
    OnFileUploaded="Uploader1_FileUploaded" /&gt;

Protected Sub Uploader1_FileUploaded(ByVal sender As Object,
        ByVal e As AjaxUploader.Events.FileUploadedEventArgs)
    ' Runs once per file on the postback
    Dim svc As New AjaxUploader.Services.UploadService()
    svc.CopyFile(e.FileGuid, "~/uploads/" &amp; Guid.NewGuid().ToString("N") &amp;
        System.IO.Path.GetExtension(If(e.FileName, "")))
End Sub</code></pre> </div>
</div> </div>
</asp:Content>
