Validating filenames with regularexpressionvalidator
Begin by adding some variables and functions (also referred to as methods) to the new class.You'll notice the method super() called from the File Extension Validator() constructor.You can use File Extension Validator for the class name.You'll take advantage of the built-in Flex Validator superclass, which comes with very useful validation properties and methods.As standard practice, constants are declared in capital letters, with words separated by an underscore (_).Constants make your job easier; for example, if you have multiple locations in code where you check variables against a value, a constant ensures you don't misspell the value in any of those places.Suppose you want your user to upload only file then you Regular expression for that will be: But, this does not mean that user will be forced to upload file, this validation is only performed if user tries to upload file.
This omits it from the generated documentation; thus, valid Extensions and error Message are treated as if they are properties rather than methods.In fact, the Adobe Flex team uses the ASDoc tool to generate the Adobe Flex Language Reference.keyword to indicate that this is a constant with a fixed value.The Regular Expression Validator control is used to ensure that an input value matches a specified pattern.The validation will not fail if the input control is empty.
Search for validating filenames with regularexpressionvalidator:
Packages enable you to organize your code in hierarchical structures, making it easier to find and use.