Server-Side Validation - VB.NET

Demo uploads land in a temporary store and are swept after 60 minutes. To keep files, handle FileUploaded — see Single File for the complete save pattern.
The enforcement layer, in VB.NET

FileValidating runs server-side on the postback, before FileUploaded. Set e.Cancel = True and the file never reaches your save logic - regardless of what the client claimed.

What you should see: normal files are accepted and saved; an empty file or a .tmp file is listed as REJECTED with the reason, and no save occurs for it.
Drag & drop files here, or paste from clipboard
    Protected Sub Uploader1_FileValidating(ByVal sender As Object,
            ByVal e As AjaxUploader.Events.FileValidatingEventArgs)
        If e.FileSize <= 0 Then
            e.Cancel = True
            e.CancelReason = "Empty files are not allowed."
        ElseIf String.Equals(System.IO.Path.GetExtension(If(e.FileName, "")),
                ".tmp", StringComparison.OrdinalIgnoreCase) Then
            e.Cancel = True
            e.CancelReason = ".tmp files are blocked by server policy."
        End If
    End Sub