How to check for valid extensions in files provided by users

asked 14 Sep '11, 07:50

Jake's gravatar image

Jake ♦♦
796222226235
accept rate: 98%


If you need your users to provide a file, such as a license file, you can find useful to check for a particular set of extensions. This goal can be achieved using a <regExMatch> rule:

<fileParameter>
    <name>licensekey</name>
    <title>Install License</title>
    <explanation>Please specify the license key you would like to use.</explanation>
    <allowEmptyValue>0</allowEmptyValue>
    <ask>yes</ask>
    <validationActionList>
        <throwError>
            <text>License file should be "license.key"</text>
            <ruleList>
                <!-- Checks for .key and .reg extensions. To add more extensions: .*\.(key|reg|other|other2)$ -->
                <regExMatch text="${licenseKey}" logic="does_not_match" pattern=".*\.(key|reg)$"/>
            </ruleList>
        </throwError>
    </validationActionList>
</fileParameter>

link

answered 14 Sep '11, 07:51

Jake's gravatar image

Jake ♦♦
796222226235
accept rate: 98%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×6
×4
×2
×2

Asked: 14 Sep '11, 07:50

Seen: 1,279 times

Last updated: 15 Sep '11, 10:14