You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Willis Blackburn (JIRA)" <ji...@apache.org> on 2011/01/23 05:49:44 UTC

[jira] Created: (WICKET-3370) Extend multiple file handling to IMultipartWebRequest

Extend multiple file handling to IMultipartWebRequest
-----------------------------------------------------

                 Key: WICKET-3370
                 URL: https://issues.apache.org/jira/browse/WICKET-3370
             Project: Wicket
          Issue Type: Improvement
          Components: wicket
    Affects Versions: 1.5-M3
            Reporter: Willis Blackburn


HTML 5 allows a new attribute with file input tags called "multiple," which lets the user choose multiple files to upload.  It works for me in Safari 4 and Firefox 3.6.  It probably works in Chrome and probably doesn't work in IE (like everything else).

So I set about creating a MultiFileUploadField that uses a List<FileUpload> as its model.  Unfortunately it looks like while MultipartServletWebRequestImpl does a fine job of parsing out each file in the multi-file upload, the IMultipartWebRequest interface isn't up to the task:  it assumes that each field only has one file.

I think that it would be straightforward to make IMultipartWebRequest map field names to List<FileItem> instead of just FileItem.  The existing FileUpload field (and indeed any other user of this interface) could just use the first FileItem in the list, or the last, if it really wanted to reproduce the existing behavior exactly (in which each new file for some field "f" overwrites the previous one in the map, leaving the last).

Alternately there could be a couple of new methods:

public Map<String, List<FileItem>> getFileLists();

public List<FileItem> getFileList(final String fieldName);

with the other two methods retaining the old behavior.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-3370) Extend multiple file handling to IMultipartWebRequest

Posted by "Willis Blackburn (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3370?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12994115#comment-12994115 ] 

Willis Blackburn commented on WICKET-3370:
------------------------------------------

I'm using Safari 4.  Maybe you need multiple="multiple"?  That's what I have.  Then of course in the file selector you need to shift- or control- or command-select a bunch of files.

W






> Extend multiple file handling to IMultipartWebRequest
> -----------------------------------------------------
>
>                 Key: WICKET-3370
>                 URL: https://issues.apache.org/jira/browse/WICKET-3370
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.5-M3
>            Reporter: Willis Blackburn
>            Assignee: Martin Grigorov
>
> HTML 5 allows a new attribute with file input tags called "multiple," which lets the user choose multiple files to upload.  It works for me in Safari 4 and Firefox 3.6.  It probably works in Chrome and probably doesn't work in IE (like everything else).
> So I set about creating a MultiFileUploadField that uses a List<FileUpload> as its model.  Unfortunately it looks like while MultipartServletWebRequestImpl does a fine job of parsing out each file in the multi-file upload, the IMultipartWebRequest interface isn't up to the task:  it assumes that each field only has one file.
> I think that it would be straightforward to make IMultipartWebRequest map field names to List<FileItem> instead of just FileItem.  The existing FileUpload field (and indeed any other user of this interface) could just use the first FileItem in the list, or the last, if it really wanted to reproduce the existing behavior exactly (in which each new file for some field "f" overwrites the previous one in the map, leaving the last).
> Alternately there could be a couple of new methods:
> public Map<String, List<FileItem>> getFileLists();
> public List<FileItem> getFileList(final String fieldName);
> with the other two methods retaining the old behavior.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Resolved: (WICKET-3370) Extend multiple file handling to IMultipartWebRequest

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3370?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Grigorov resolved WICKET-3370.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.5-RC2

With r1070416  FileUploadField has method getFileUploads() which returns a list of all uploaded files in the current request.
The old method #getFileUpload() is still there and returns just the first uploaded file.

And example is added in wicket examples - UploadPage.(java|html).

> Extend multiple file handling to IMultipartWebRequest
> -----------------------------------------------------
>
>                 Key: WICKET-3370
>                 URL: https://issues.apache.org/jira/browse/WICKET-3370
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.5-M3
>            Reporter: Willis Blackburn
>            Assignee: Martin Grigorov
>             Fix For: 1.5-RC2
>
>
> HTML 5 allows a new attribute with file input tags called "multiple," which lets the user choose multiple files to upload.  It works for me in Safari 4 and Firefox 3.6.  It probably works in Chrome and probably doesn't work in IE (like everything else).
> So I set about creating a MultiFileUploadField that uses a List<FileUpload> as its model.  Unfortunately it looks like while MultipartServletWebRequestImpl does a fine job of parsing out each file in the multi-file upload, the IMultipartWebRequest interface isn't up to the task:  it assumes that each field only has one file.
> I think that it would be straightforward to make IMultipartWebRequest map field names to List<FileItem> instead of just FileItem.  The existing FileUpload field (and indeed any other user of this interface) could just use the first FileItem in the list, or the last, if it really wanted to reproduce the existing behavior exactly (in which each new file for some field "f" overwrites the previous one in the map, leaving the last).
> Alternately there could be a couple of new methods:
> public Map<String, List<FileItem>> getFileLists();
> public List<FileItem> getFileList(final String fieldName);
> with the other two methods retaining the old behavior.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (WICKET-3370) Extend multiple file handling to IMultipartWebRequest

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3370?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12994101#comment-12994101 ] 

Martin Grigorov commented on WICKET-3370:
-----------------------------------------

I modified wicket code and now it works with List<FileItem> (not committed yet) and signle file upload still works without any changes in the user application code.
I have a question: how do you select multiple files for upload ?
I tried with Firefox 3.6.13 and Google Chrome 9.x and <input type="file" multiple /> doesn't allow me to select more than one file for upload.

> Extend multiple file handling to IMultipartWebRequest
> -----------------------------------------------------
>
>                 Key: WICKET-3370
>                 URL: https://issues.apache.org/jira/browse/WICKET-3370
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.5-M3
>            Reporter: Willis Blackburn
>
> HTML 5 allows a new attribute with file input tags called "multiple," which lets the user choose multiple files to upload.  It works for me in Safari 4 and Firefox 3.6.  It probably works in Chrome and probably doesn't work in IE (like everything else).
> So I set about creating a MultiFileUploadField that uses a List<FileUpload> as its model.  Unfortunately it looks like while MultipartServletWebRequestImpl does a fine job of parsing out each file in the multi-file upload, the IMultipartWebRequest interface isn't up to the task:  it assumes that each field only has one file.
> I think that it would be straightforward to make IMultipartWebRequest map field names to List<FileItem> instead of just FileItem.  The existing FileUpload field (and indeed any other user of this interface) could just use the first FileItem in the list, or the last, if it really wanted to reproduce the existing behavior exactly (in which each new file for some field "f" overwrites the previous one in the map, leaving the last).
> Alternately there could be a couple of new methods:
> public Map<String, List<FileItem>> getFileLists();
> public List<FileItem> getFileList(final String fieldName);
> with the other two methods retaining the old behavior.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Assigned: (WICKET-3370) Extend multiple file handling to IMultipartWebRequest

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3370?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Grigorov reassigned WICKET-3370:
---------------------------------------

    Assignee: Martin Grigorov

> Extend multiple file handling to IMultipartWebRequest
> -----------------------------------------------------
>
>                 Key: WICKET-3370
>                 URL: https://issues.apache.org/jira/browse/WICKET-3370
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.5-M3
>            Reporter: Willis Blackburn
>            Assignee: Martin Grigorov
>
> HTML 5 allows a new attribute with file input tags called "multiple," which lets the user choose multiple files to upload.  It works for me in Safari 4 and Firefox 3.6.  It probably works in Chrome and probably doesn't work in IE (like everything else).
> So I set about creating a MultiFileUploadField that uses a List<FileUpload> as its model.  Unfortunately it looks like while MultipartServletWebRequestImpl does a fine job of parsing out each file in the multi-file upload, the IMultipartWebRequest interface isn't up to the task:  it assumes that each field only has one file.
> I think that it would be straightforward to make IMultipartWebRequest map field names to List<FileItem> instead of just FileItem.  The existing FileUpload field (and indeed any other user of this interface) could just use the first FileItem in the list, or the last, if it really wanted to reproduce the existing behavior exactly (in which each new file for some field "f" overwrites the previous one in the map, leaving the last).
> Alternately there could be a couple of new methods:
> public Map<String, List<FileItem>> getFileLists();
> public List<FileItem> getFileList(final String fieldName);
> with the other two methods retaining the old behavior.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (WICKET-3370) Extend multiple file handling to IMultipartWebRequest

Posted by "Willis Blackburn (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3370?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12985316#action_12985316 ] 

Willis Blackburn commented on WICKET-3370:
------------------------------------------

Or maybe just one new method:

public List<FileLitem> getAllFiles();

that would return the List<FileItem> collection created by MultipartServletWebRequestImpl.

> Extend multiple file handling to IMultipartWebRequest
> -----------------------------------------------------
>
>                 Key: WICKET-3370
>                 URL: https://issues.apache.org/jira/browse/WICKET-3370
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.5-M3
>            Reporter: Willis Blackburn
>
> HTML 5 allows a new attribute with file input tags called "multiple," which lets the user choose multiple files to upload.  It works for me in Safari 4 and Firefox 3.6.  It probably works in Chrome and probably doesn't work in IE (like everything else).
> So I set about creating a MultiFileUploadField that uses a List<FileUpload> as its model.  Unfortunately it looks like while MultipartServletWebRequestImpl does a fine job of parsing out each file in the multi-file upload, the IMultipartWebRequest interface isn't up to the task:  it assumes that each field only has one file.
> I think that it would be straightforward to make IMultipartWebRequest map field names to List<FileItem> instead of just FileItem.  The existing FileUpload field (and indeed any other user of this interface) could just use the first FileItem in the list, or the last, if it really wanted to reproduce the existing behavior exactly (in which each new file for some field "f" overwrites the previous one in the map, leaving the last).
> Alternately there could be a couple of new methods:
> public Map<String, List<FileItem>> getFileLists();
> public List<FileItem> getFileList(final String fieldName);
> with the other two methods retaining the old behavior.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.