I am using the FileUpload 1.1 library in Weblogic 8.1 SP4, and am trying to
get uploading to work in portlets. Whenever I try to parse my multipart
content, I get an exception with the message "the request was rejected
because it's size is unknown".
Here are some relevant code snippets.
public void processAction(ActionRequest request, ActionResponse
response) throws PortletException
{
if (PortletFileUpload.isMultipartContent(request))
{
DiskFileItemFactory factory = new DiskFileItemFactory();
PortletFileUpload upload = new PortletFileUpload(factory);
try
{
List fileItems = upload.parseRequest(request);
FileItem item = (FileItem)fileItems.iterator().next();
File uploadedFile = new File(type + item.getName());
item.write(uploadedFile);
}
catch (Exception ex)
{
System.out.println("EXCEPTION: File upload request error:
" + ex.getMessage());
//ex.printStackTrace();
return;
}
...
My jsp file contains:
<form action="<portlet:actionURL />" method="post"
enctype="multipart/form-data">
<table width="100%" cellspacing="0" cellpadding="3" >
<tr>
<td>Title</td>
<td> <input type="text" name="title"></td>
</tr>
<tr>
<td>Description</td>
<td> <input type="text" name="description"></td>
</tr>
<tr>
<td>File</td>
<td> <input type="file" name="upfile" ></td>
</tr>
</table>
<input type="submit" name="doUpload" value="upload"/>
<input type="submit" name="cancel" value="cancel"/>
</form>
I have tried this with size set and unset in the "<input type="file""
section.
I have tried several forums already and gotten no responses. Any
direction/help would be appreciated.
-Guhn Chang
[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]