private List<FileItem> readMultipartFileItems(CmsUploadListener listener) throws Exception {

        DiskFileItemFactory factory = new DiskFileItemFactory();
        // maximum size that will be stored in memory
        factory.setSizeThreshold(4096);
        // the location for saving data that is larger than the threshold
        File temp = new File(OpenCms.getSystemInfo().getPackagesRfsPath());
        if (temp.exists() || temp.mkdirs()) {
            // make sure the folder exists
            factory.setRepository(temp);
        }

        // create a file upload servlet
        ServletFileUpload fu = new ServletFileUpload(factory);
        // set the listener
        fu.setProgressListener(listener);
        // set encoding to correctly handle special chars (e.g. in filenames)
        fu.setHeaderEncoding(getRequest().getCharacterEncoding());
        // set the maximum size for a single file (value is in bytes)
        long maxFileSizeBytes = OpenCms.getWorkplaceManager().getFileBytesMaxUploadSize(getCmsObject());
        if (maxFileSizeBytes > 0) {
            fu.setFileSizeMax(maxFileSizeBytes);
        }

        // try to parse the request
        try {
            return CmsCollectionsGenericWrapper.list(fu.parseRequest(getRequest()));
        } catch (SizeLimitExceededException e) {
            // request size is larger than maximum allowed request size, throw an error
            Integer actualSize = new Integer((int)(e.getActualSize() / 1024));
            Integer maxSize = new Integer((int)(e.getPermittedSize() / 1024));
            throw new CmsUploadException(
                m_bundle.key(org.opencms.ade.upload.Messages.ERR_UPLOAD_REQUEST_SIZE_LIMIT_2, actualSize, maxSize),
                e);
        } catch (FileSizeLimitExceededException e) {
            // file size is larger than maximum allowed file size, throw an error
            Integer actualSize = new Integer((int)(e.getActualSize() / 1024));
            Integer maxSize = new Integer((int)(e.getPermittedSize() / 1024));
            throw new CmsUploadException(
                m_bundle.key(
                    org.opencms.ade.upload.Messages.ERR_UPLOAD_FILE_SIZE_LIMIT_3,
                    actualSize,
                    e.getFileName(),
                    maxSize),
                e);
        }
    }
private List < FileItem > readMultipartFileItems ( CmsUploadListener listener ) throws Exception { DiskFileItemFactory factory = new DiskFileItemFactory ( ) ; factory . setSizeThreshold ( 4096 ) ; File temp = new File ( OpenCms . getSystemInfo ( ) . getPackagesRfsPath ( ) ) ; if ( temp . exists ( ) || temp . mkdirs ( ) ) { factory . setRepository ( temp ) ; } ServletFileUpload fu = new ServletFileUpload ( factory ) ; fu . setProgressListener ( listener ) ; fu . setHeaderEncoding ( getRequest ( ) . getCharacterEncoding ( ) ) ; long maxFileSizeBytes = OpenCms . getWorkplaceManager ( ) . getFileBytesMaxUploadSize ( getCmsObject ( ) ) ; if ( maxFileSizeBytes > 0 ) { fu . setFileSizeMax ( maxFileSizeBytes ) ; } try { return CmsCollectionsGenericWrapper . list ( fu . parseRequest ( getRequest ( ) ) ) ; } catch ( SizeLimitExceededException e ) { Integer actualSize = new Integer ( ( int ) ( e . getActualSize ( ) / 1024 ) ) ; Integer maxSize = new Integer ( ( int ) ( e . getPermittedSize ( ) / 1024 ) ) ; throw new CmsUploadException ( m_bundle . key ( org . opencms . ade . upload . Messages . ERR_UPLOAD_REQUEST_SIZE_LIMIT_2 , actualSize , maxSize ) , e ) ; } catch ( FileSizeLimitExceededException e ) { Integer actualSize = new Integer ( ( int ) ( e . getActualSize ( ) / 1024 ) ) ; Integer maxSize = new Integer ( ( int ) ( e . getPermittedSize ( ) / 1024 ) ) ; throw new CmsUploadException ( m_bundle . key ( org . opencms . ade . upload . Messages . ERR_UPLOAD_FILE_SIZE_LIMIT_3 , actualSize , e . getFileName ( ) , maxSize ) , e ) ; } }
Parses a request of the form <code>multipart/form-data</code>.<p>

The result list will contain items of type <code>{@link FileItem}</code>.
If the request has no file items, then <code>null</code> is returned.<p>

@param listener the upload listener

@return the list of <code>{@link FileItem}</code> extracted from the multipart request,
or <code>null</code> if the request has no file items

@throws Exception if anything goes wrong