FileValidating Method

Last post 10-23-2012, 7:56 AM by Kenneth. 1 replies.
Sort Posts: Previous Next
  •  10-23-2012, 1:41 AM 75038

    FileValidating Method

     Hi,

     

    i want to validate each file on upload process.

     

    If i want to stop certain file upload during multiple file upload process, How do i do?

     

    For example,

    protected  void Uploader_FileValidating(object sender, CuteWebUI.UploaderEventArgs args)

    {

          string strFileName = args.FileName;

          if (Path.GetFileName(strFileName).Equals("aaa.txt"))

                       {

                              //I want to say here no upload for this file 

                         }

    }

     

    Lets simple, if 2 files are failed in the validation out of 10 files are in upload process, how do i stop these 2 files and show the

    status with error.

  •  10-23-2012, 7:56 AM 75041 in reply to 75038

    Re: FileValidating Method

    Hi kalees1980,

     

    you an achieve it in event "FileUploaded", like below

     

    1. protected void uploader1_FileUploaded(object sender, UploaderEventArgs args)  
    2.    {  
    3.        if (args.FileName == "12.jpg")  
    4.        {  
    5.            args.Delete();  
    6.        }  
    7.    }  
     

    Regards,

     

    Ken 

View as RSS news feed in XML