This content has been marked as final.
Show 1 reply
-
1. Re: Tomahawk fileUpload tag
rlhr Oct 9, 2006 7:55 AM (in response to rlhr)So the tomahawk inputFileUpload tag uses commons-fileupload library.
The uploaded file is uploded and stored either in memory or on the disk as a tmp file.
This is up to the user to write the temporary file into a permanent file.
The FileItem.write(File file) methods will do that but we have to call the write method on the fileItem.
So this is the part that was missing in the wiki (http://wiki.jboss.org/wiki/Wiki.jsp?page=Alternative_FileUpload) for the use of the inputFileUpload tag.
In the upload method of the uploadAction bean, I added to following:File file = new File("/upload/" + + uploadFile.getName()); ServletRequest multipartRequest = (ServletRequest)facesContext.getExternalContext().getRequest(); if (multipartRequest != null) { MultipartRequestWrapper mpReq = (MultipartRequestWrapper)multipartRequest; FileItem fileItem = mpReq.getFileItem("uploadForm:uploadFile"); try { fileItem.write(file); } catch (Exception e) { log.error(e); } }
Which rename the tmp file info the appropriate file.