org.apache.cocoon.components.language.markup.xsp.XSPUtil org.apache.avalon.framework.context.ContextException File uploadDir = null; /** Contextualize this class */ public void contextualize(Context context) throws ContextException { uploadDir = (File) context.get(Constants.CONTEXT_UPLOAD_DIR); } This form allows you upload files Uploads in cocoon are handled automatically, as configured in web.xml. The relevant init-params controlling upload behavior are: enable-uploads, upload-directory, autosave-uploads, overwrite-uploads, upload-max-size. All files are cleaned out of the upload directory at the end of the request. The assumption is that other application logic will have acted on the files during the request.
File:

if ( != null) { Parameter uploaded_file:
Parameter uploaded_file is instance of: request.get("uploaded_file").getClass()
} else if (request.getContentType()!=null && request.getContentType().indexOf("multipart/form-data") != -1) { Either uploads are turned off, or you submitted a blank form. To enable uploads, ensure that the value for the init-param "enable-uploads" in web.xml is set to true. }
Upload directory content:
    getLogger().debug("Dir=" + uploadDir); String[] filelist = uploadDir.list();
  • filelist[i]
Brought to you by Cocoon at new Date().