Re: Validate Sum of file size for multiple files

  •  06-28-2011, 8:54 AM

    Re: Validate Sum of file size for multiple files

    Hi Joe,
     
    You can refer to the following method:
     
     protected void UploadAttachments1_FileValidating(object sender, UploaderEventArgs args)  
        {   
            string disabledExtList = "aspx,asp,ashx,html,htm,mht,exe,dll,php,jsp";        
            //validate the extensions  
            string ext=Path.GetExtension(args.FileName).TrimStart('.').ToLower();  
            ext = "," + ext + ",";  
            string list="," + disabledExtList.ToLower() + ",";  
            if (list.IndexOf(ext) != -1)  
            {  
                throw (new Exception("Invalid file type!"));  
            }  
        }  
     
    Thanks for asking
View Complete Thread