[ 
https://issues.apache.org/jira/browse/WICKET-6210?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15412432#comment-15412432
 ] 

Matt Pavlovich edited comment on WICKET-6210 at 8/8/16 8:46 PM:
----------------------------------------------------------------

Tracked down line of code responsible:

FileUploadField.class

line:115   "item.getSize() > 0".. this causes the retuned list of filenames to 
be empty, and the upload to not succeed

{noformat}
        // If we successfully installed a multipart request
                if (request instanceof IMultipartWebRequest)
                {
                        // Get the item for the path
                        final List<FileItem> fileItems = 
((IMultipartWebRequest)request).getFile(getInputName());

                        if (fileItems != null)
                        {
                                for (FileItem item : fileItems)
                                {
                                        // Only update the model when there is 
a file (larger than zero
                                        // bytes)
                                        if (item != null && item.getSize() > 0)
                                        {
                                                fileUploads.add(new 
FileUpload(item));
                                        }
                                }
                        }
                }
{noformat}

Debugger shows web browser and servlet passes complete request:

{noformat}
fileItems: [name=zero.txt, StoreLocation=null, size=0bytes, isFormField=false, 
FieldName=fileInput]
{noformat}


was (Author: mattrpav):
Found line of code:

FileUploadField.class

line:115
{noformat}
        // If we successfully installed a multipart request
                if (request instanceof IMultipartWebRequest)
                {
                        // Get the item for the path
                        final List<FileItem> fileItems = 
((IMultipartWebRequest)request).getFile(getInputName());

                        if (fileItems != null)
                        {
                                for (FileItem item : fileItems)
                                {
                                        // Only update the model when there is 
a file (larger than zero
                                        // bytes)
                                        if (item != null && item.getSize() > 0)
                                        {
                                                fileUploads.add(new 
FileUpload(item));
                                        }
                                }
                        }
                }
{noformat}


> FileUpload does not support files of zero size
> ----------------------------------------------
>
>                 Key: WICKET-6210
>                 URL: https://issues.apache.org/jira/browse/WICKET-6210
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 6.22.0
>            Reporter: Matt Pavlovich
>            Priority: Minor
>         Attachments: wicket-6210.zip
>
>
> When attempting to use the wicket fileupload component, if the user selects a 
> file of size zero, the operation fails.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to