This content has been marked as final.
Show 1 reply
-
1. Re: How to upload file with Portlet
roy.russo May 31, 2005 9:38 AM (in response to mico)Take a look at the AdminCMSPortlet. The upload.jsp has something like this:
<form name="uploadform" method="post" enctype="multipart/form-data" action= ...
Make sure you are using the most recent version of fileupload that allows for portlet fileuploads. Previous versions did not.
The code you're looking for begins with this:DiskFileItemFactory factory = new DiskFileItemFactory(); PortletFileUpload upload = new PortletFileUpload(factory); // TODO: configure uploader String sPath = ""; List fileItems = upload.parseRequest(aReq); // TODO: mod interface to allow multiple uploads. Iterator itr = fileItems.iterator(); while(itr.hasNext()) { FileItem item = (FileItem) itr.next();