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.


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3976950#3976950

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3976950
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to