コード例 #1
0
        static void FileValidated(InputField inputField, InputFieldValidationEventArgs e)
        {
            // here, you can also do something with the posted file
            // (save it, email it, etc, or test it and report back to the user)
            // this event gets fired following the validation of any class derived from InputField
            // here you can have more fine grained control of validation
            // for example:

            if (e.IsValid)
            {
                var fileUpload = inputField as FileUpload;

                if (fileUpload != null)
                {
                    if (fileUpload.PostedFile.ContentLength > 102400)
                    {
                        fileUpload.Error = "The file is too large.";
                    }
                }
            }
        }
コード例 #2
0
        static void FileValidated(InputField inputField, InputFieldValidationEventArgs e)
        {
            // here, you can also do something with the posted file
            // (save it, email it, etc, or test it and report back to the user)
            // this event gets fired following the validation of any class derived from InputField
            // here you can have more fine grained control of validation
            // for example:

            if (e.IsValid)
            {
                var fileUpload = inputField as FileUpload;

                if (fileUpload != null)
                    if (fileUpload.PostedFile.ContentLength > 102400)
                    {
                        fileUpload.Error = "The file is too large.";
                    }
            }
        }