To be honest, I'm not sure exactly what the Struts framework is using to manage the file uploads. I simply create a FormFile member in my ActionForm and it gets populated correctly with the uploaded file data.

Is this a parameter I can configure within Struts? Is there a feasible replacement should this be the culprit?

many thanks,
Collin

Adam Hardy wrote:
Collin,

are you using org.apache.commons.fileupload.DiskFileUpload.parseRequest(request)

?

I'm not sure anymore if this is wrapped by struts or not, but I guess it is and it's this bit that isn't working.

Adam


Collin VanDyck on 02/11/05 20:53, wrote:

Hello All

Any ideas on this one? I switched to a manual validation, which works, though I'd much rather use the built-in mechanism to validate where possible.

thanks
Collin


Collin VanDyck wrote:

Hello!

I'm using struts-1.2.7.

I have form that needs both file upload functionality as well as normal form fields interspersed on the same HTML page. I'm using the built-in struts file upload utilities, so I create the form:

<html:form method="POST" action="/entity/submitfile.act" enctype="multipart/form-data">
   ...
</html:form>

If there are no errors, this approach works perfectly. I correctly receive the file data submitted, if any, along with the normal form field values.

However, if my ActionForm fails validation, when the resultant action gets called (specified by the input attribute) the request object contains no request data from my form. My ActionForm, however, populates correctly.

I understand that for multipart/form-data encoding types that the framework will wrap the normal request object in a MultipartRequestWrapper. Indeed, this is the case when this form submits. The MultipartRequestWrapper does not contain any of my request parameters from the form. I called MultipartRequestWrapper.getRequest() to get the original request that was wrapped to begin with, but it also does not have any of my request parameters.

The strange thing is, is that if I convert the form to not be multipart/form-data encoded, and remove the file upload widget, it works perfectly, retaining request parameters even when validation fails.

Any ideas on what I may be doing wrong? I feel like this is probably a common problem. I found some similar problems on the mailing list archives, but could not find any resolutions.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to