Re: How do I get UploadAttachments events to fire for server-side validation prior to upload?

  •  03-13-2012, 2:18 PM

    Re: How do I get UploadAttachments events to fire for server-side validation prior to upload?

    You can do the same thing in Ajax Uploader.
     
     
    Private Sub Uploader_FileUploaded(ByVal sender As Object, ByVal args As UploaderEventArgs)
                
                Dim fname As String = args.FileName
     
                'Here I can do some validation on the file type
               If fname.EndsWith(".jpg") Then
              
                       'I can also augment the file name prior to uploading, like this:
                       fname = Now.ToString("yyyyMMdd-HHMMss-") & fname
     
                      'Copies the uploaded file to a new location.
                      'args.CopyTo("c:\\temp\\"& fname) 
             Else
                      'Inform user that file must be of type .jpg 
             End If 
    End Sub 
    <CuteWebUI:Uploader runat="server" ID="Uploader1" OnFileUploaded="Uploader_FileUploaded"></CuteWebUI:Uploader>
     
    Even better, Ajax Uploader can detect the allowed file upload types in the client end.
     
    Demo: 
     
     
    Code:
     
    <CuteWebUI:Uploader runat="server" ID="Uploader1" OnFileUploaded="Uploader_FileUploaded">
          <ValidateOption AllowedFileExtensions="jpeg,jpg,gif,png" MaxSizeKB="100" />
    </CuteWebUI:Uploader>
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

View Complete Thread