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

Thomas Maerz thomasmaerz at gmx.de
Mon Aug 1 17:00:51 CEST 2005


Alessandro Magnolo <alessandro.magnolo at gmail.com> writes:

> i think that the problem is related to the fact that opencms processes
> the request before passing it to my code.

I don't think so.

> 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.

Maybe your HTML for the form is wrong.

Just found org.opencms.util.CmsRequestUtil#readMultipartFileItems()

|     public static List readMultipartFileItems(HttpServletRequest request) {
| 
|         if (!FileUploadBase.isMultipartContent(request)) {
|             return null;
|         }
|         DiskFileUpload fu = new DiskFileUpload();
|         // maximum size that will be stored in memory
|         fu.setSizeThreshold(4096);
|         // the location for saving data that is larger than getSizeThreshold()
|         fu.setRepositoryPath(OpenCms.getSystemInfo().getPackagesRfsPath());
|         List result = new ArrayList();
|         try {
|             List items = fu.parseRequest(request);
|             if (items != null) {
|                 result = items;
|             }
|         } catch (FileUploadException e) {
|             LOG.error(Messages.get().key(Messages.LOG_PARSE_MULIPART_REQ_FAILED_0), e);
|         }
|         return result;
|     }


Regards,
Thomas




More information about the opencms-dev mailing list