Need help w/ uploading file

ligerdave <[email protected]> Sat, 16 Dec 2006 10:55:52 CST
Newsgroups gmane.comp.java.open-symphony.webwork
Message-ID <32229200.1166288452247.JavaMail.os-j2ee@opensymphony01.managed.contegix.com>
okay, i have followed all the instructions and my my own. however, the upload action doesn't even get passed through the validation sometime when i use the firefox as the testing browser. the IE seems to be fine except the very first run. any idea?

[b]IN MY JSP:[/b]
<s:form action="Message/Send" method="POST" enctype="multipart/form-data">
		 	
		 		<s:textfield label="%{getText('label.mailReceiver')}" name="receiver" cssStyle="width:100%"/>
		 		<s:textfield label="%{getText('label.mailTitle')}" name="title" cssStyle="width:100%"/>
		 		<s:textarea label="%{getText('label.mailBody')}" name="body" rows="10" cssStyle="width:100%"/>
		 		<s:file name="upload" label="%{getText('label.mailImageFileAttachment')}" value=''/>
		 		<s:submit value="%{getText('label.send')}"/>

		 	
		 	</s:form>

[b]IN MY JAVA:[/b]
private String body;

	private String receiver;

	private String title;

	private File upload;

	private String uploadContentType;

	private String uploadFileName;

and all the setters and getters

[b]IN XML:[/b]

<package name="service" namespace="/Service"
		extends="struts-default">

		<action name="Message/Send"
			class="test.SendMessage">
			<interceptor-ref name="fileUpload">
				<param name="allowedTypes">
					image/png,image/gif,image/jpeg,image/jpg,image/pjpeg,application/octet-stream
				</param>
				<param name="maximumSize">240800</param>
			</interceptor-ref>
			<interceptor-ref name="basicStack" />
			<result name="login" type="redirect-action">
				Login+input
			</result>
			<result name="input">/jsp/composeMessage.jsp</result>
			<result name="success" type="redirect-action">Message/Inbox</result>
		</action>

[b]IN MY VALIDATE.XML[/b]
<validators>
	<field name="upload">
		<field-validator type="fieldexpression">
			<param name="expression">
				<![CDATA[upload != null && (upload.indexOf(".jpg") != -1 || upload.indexOf(".gif") != -1 || upload.indexOf(".png") != -1)]]>
			</param>
			<message>upload error</message>
		</field-validator>
	</field>
	<field name="receiver">
		<field-validator type="fieldexpression">
			<param name="expression">
				<![CDATA[receiver != null]]>
			</param>
			<message>receiver error</message>
		</field-validator>
	</field>
	<field name="body">
		<field-validator type="requiredstring">
			<message>body error„</message>
		</field-validator>

		<field-validator type="stringlength">
			<param name="minLength">1</param>
			<param name="maxLength">65535</param>
			<message>
				body error
			</message>
		</field-validator>
	</field>
</validators>


[b]PLEASE HELP!!!!![/b]

Philip!!!!!
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=53923&messageID=108211#108211

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]