I am the core deveper of my portal. I have commited the changed and everything
work fine.
For more detail.
In the JSP page, you should have a form like :
<input type=file ......>
In the portlet corresponding .java
public void processAction(JBossActionRequest aReq, JBossActionResponse aRes)
throws PortletException {
// Prepare for processing the uploaded file
DiskFileItemFactory factory = new DiskFileItemFactory();
PortletFileUpload upload = new PortletFileUpload(factory); //
TODO: configure uploader
// Check if the upload content is ENCTYPE="multipart/form-data" in
the submitted form
if (upload.isMultipartContent(aReq))
{
logger.info(this.getClass().getName() + ": isMultiPart = true");
List fileItems = upload.parseRequest(aReq);
Iterator itr = fileItems.iterator();
while (itr.hasNext()) {
FileItem item = (FileItem) itr.next();
// check if the current item is a form field or an uploaded
file
if (!item.isFormField()) {
logger.info(this.getClass().getName() + " :Start
processing the uploaded file");
sFilename = item.getName();
logger.info(this.getClass().getName() + ": Filename = "
+ sFilename);
logger.info(this.getClass().getName() + ": contentType
= " + item.getContentType());
logger.info(this.getClass().getName() + ": isInMemory =
" + item.isInMemory());
logger.info(this.getClass().getName() + ": sizeInBytes
= " + item.getSize());
if (item.getSize()==0){
logger.info(this.getClass().getName() + "No file
selected ");
return;
}
//-- Get the inputStream of the uploaded file
is = item.getInputStream();
} else {
String fieldName = item.getFieldName();
if ("extractor_type".equals(fieldName)) {
extractor_type = item.getString();
}
if ("isRWKP".equals(fieldName)){
isRWKP = item.getString();
}
logger.info(this.getClass().getName() + ": fieldName :"
+ fieldName);
logger.info(this.getClass().getName() + ":
extractor_type :" + extractor_type);
logger.info(this.getClass().getName() + ": isRWKP :" +
isRWKP);
}
} // End while itr.hasNext()
logger.info(this.getClass().getName() + ": InputeStream
is.length = " + is.available());
//* Call method extractByLOCAL
extractByLOCAL(extractor_type, is, sFilename, isRWKP);
} // End if isMultipart
}// End processAction()
The above code is what I implemented.
If you have any question , you can post again. In the future, I may have
questions that need you for help... ^^
my msn is [EMAIL PROTECTED]
you can add me
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3933325#3933325
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3933325
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user