Example usage for org.apache.wicket.protocol.http IMultipartWebRequest getFile

List of usage examples for org.apache.wicket.protocol.http IMultipartWebRequest getFile

Introduction

In this page you can find the example usage for org.apache.wicket.protocol.http IMultipartWebRequest getFile.

Prototype

List<FileItem> getFile(final String fieldName);

Source Link

Document

Gets the files that were uploaded using the given field name.

Usage

From source file:com.servoy.j2db.server.headlessclient.MultiFileUpload.java

License:Open Source License

/**
 * this method is identical to it's super except it creates a ServoyFileUpload.
 * ServoyFileUpload is again identical to FileUpload except it has access to the FileItem object
 *///from   www . ja va 2  s . c  o  m
@Override
protected Collection<FileUpload> convertValue(String[] value) throws ConversionException {
    // convert the array of filenames into a collection of FileItems

    Collection<FileUpload> uploads = null;

    final String[] filenames = getInputAsArray();

    if (filenames != null) {
        final IMultipartWebRequest request = (IMultipartWebRequest) getRequest();

        uploads = new ArrayList<FileUpload>(filenames.length);

        for (String filename : filenames) {
            uploads.add(new ServoyFileUpload(request.getFile(filename)));
        }
    }

    return uploads;

}

From source file:org.cast.cwm.data.component.MultipleFileUploadField.java

License:Open Source License

/**
 * @see org.apache.wicket.markup.html.form.FormComponent#convertValue(java.lang.String[])
 *///ww  w .  j ava 2s .  c o m
@Override
protected Collection<FileUpload> convertValue(String[] value) throws ConversionException {
    // convert the array of filenames into a collection of FileItems
    Collection<FileUpload> uploads = null;
    String[] filenames = getInputAsArray();

    if (filenames != null) {
        IMultipartWebRequest request = (IMultipartWebRequest) getRequest();
        uploads = new ArrayList<FileUpload>(filenames.length);
        for (int i = 0; i < filenames.length; i++) {
            for (FileItem item : request.getFile(filenames[i]))
                uploads.add(new FileUpload(item));
        }
    }
    return uploads;
}