Abdullah Jibaly wrote:
Does anyone have an example/pointers of uploading multiple files at one time?I have several forms using DynaValidatorAtionForm that have two file uploads. There's not much interesting going on, though, the framework is doing the majority of the work for me.
A form bean, trimmed:
<form-bean name="eventbean" type="org.apache.struts.validator.DynaValidatorActionForm">
<form-property name="headerFile" type="org.apache.struts.upload.FormFile" />
<form-property name="cssFile" type="org.apache.struts.upload.FormFile" />
</form-bean>
The form in the JSP is declared to be a multipart.
Processing the upload. trimmed:
FormFile cssFile = (FormFile) form_.get("cssFile"); FormFile headerFile = (FormFile) form_.get("headerFile"); //... Upload.uploadFormFile(cssFile, root); Upload.uploadFormFile(headerFile, root);
uploadFormFile, trimmed:
InputStream instream = file_.getInputStream(); byte[] contents = new byte[file_.getFileSize()]; instream.read(contents); File outputFile = new File(root_ + "/" + file_.getFileName()); FileOutputStream outstream = new FileOutputStream(outputFile); outstream.write(contents); outstream.close();
Dave
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]