[opencms-dev] How to let a user upload in VFS

Alessandro Magnolo alessandro.magnolo at gmail.com
Mon Aug 1 16:37:37 CEST 2005


On 8/1/05, Thomas Maerz <thomasmaerz at gmx.de> wrote:
> Replace the two points above with commons fileUpload:
> http://jakarta.apache.org/commons/fileupload/using.html

hello thomas, thank you for your help.

I used fileUpload successfully in the past, but I can't manage to make
it work in opencms.
i think that the problem is related to the fact that opencms processes
the request before passing it to my code.

what happens is that I get a multipart request, but the number of
items returned by the parser is always 0. this usually happens when
the request has already been parsed, in this case (I assume) by the
opencms servlet.

Here's my code:

<%
// Check that we have a file upload request
boolean isMultipart = FileUpload.isMultipartContent(request);
out.write("multipart? "+isMultipart);

FileItem item=null;
if (isMultipart) {
// Create a new file upload handler
DiskFileUpload upload = new DiskFileUpload();
// Parse the request
List /* FileItem */ items = upload.parseRequest(request);
out.write("list size="+items.size());
}
%>

regards
alessandro



More information about the opencms-dev mailing list