Martin,
Thanks for the response but unless I am missing something how do you
expect this to work?
> if("%{uploadContentType}%"=="'text/xml'")
When this server side code runs you dont have any information about
what the user is going to upload......
Has anyone got accept or size attribute of s:file tag to work?
Thanks,
Amit.
---------- Forwarded message ----------
From: "Martin Gainty" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[email protected]>
Date: Wed, 12 Dec 2007 21:59:17 -0500
Subject: Re: Struts 2, file tag, accept attribute not working?
you can hook the submit event to JS function and then test the content type
before submitting
<head>
<script language="JavaScript" type="text/javascript">
function doSubmit()
{
if("%{uploadContentType}%"=="'text/xml'")
{
document.form.action="WhateverAction";
document.form.submit();
}
}
</script>
</head>
<s:form action="'javascript:doSubmit()'">
<s:file
tooltip="Upload Your XML file"
label="XML file"
name="XML file" />
<s:submit onclick="javascript:doSubmit()" />
</s:form>
----- Original Message -----
From: "Amit Rana" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, December 12, 2007 5:48 AM
Subject: Re: Struts 2, file tag, accept attribute not working?
> Hi Anton,
> Were you able to finally get it to work?
>
> I am using 2.0.9 and accept just doens't seem to be doing anything.
>
> Regards,
> Amit.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]