Commits

Anonymous committed 7959a28

extended file upload example, such that it checks that the filename should not be more than 15 characters long

git-svn-id: http://svn.opensymphony.com/svn/webwork/trunk@2914573baa09-0c28-0410-bef9-dab3c582ae83

Comments (0)

Files changed (2)

webapps/showcase/src/java/com/opensymphony/webwork/showcase/fileupload/FileUploadAction-validation.xml

+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE validators PUBLIC 
+	"-//OpenSymphony Group//XWork Validator 1.0.2//EN" 
+	"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+	
+<validators>
+	<field name="uploadFileName">
+		<field-validator type="stringlength">
+			<param name="maxLength">15</param>
+			<param name="trim">true</param>
+			<message>File Name is toooo long</message>
+		</field-validator>
+	</field>
+</validators>

webapps/showcase/src/webapp/fileupload/upload.jsp

 
 <body>
     <h1>Fileupload sample</h1>
-	<p>There is a file upload limit of 1048576 bytes (approximately 2MB)</p>
+	<ul>
+		<li>There is a file upload limit of 1048576 bytes (approximately 2MB)</li>
+		<li>The filename must not be greater than 15 characters (eg. readme.txt is 10 characters)</li>
+	</ul>
 	
 	<ww:fielderror />