Note, this code is reportedly (GeoffHoward) wrong, but I don't know what's wrong with it. This came from an earlier version of FileUploadsWithFlow. I moved it to its own page and added a link from FileUploadsWithCocoon2.1, because it had nothing to do with flow. -- MarkLundquist


If you have a custom sitemap component that you want to handle an upload request, you can include the following Java code:

  import org.apache.cocoon.servlet.multipart.*;

  ...

  Request request = ObjectModelHelper.getRequest(obj);
  if (request instanceof MultipartHttpServletRequest) {
    Part part = (Part) request.get("upload-file");
    if (part != null) {
      // do something with it
    } else {
      // parameter not found
    }
  } else {
    // upload is disabled
  }

FileUploadsInCustomActions (last edited 2009-09-20 23:40:32 by localhost)