You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Joe Smith <ap...@yahoo.com> on 2004/10/20 19:40:26 UTC

file item is always processed last in commons upload?

I want to know if file item (<input type="file">) is always being processed last using commons upload?

For the following code, it always process form fields first. Is that always true? That's my observations. 

if (!item.isFormField())
{
//CALL SECOND ??
//process file item
}
else
{
//CALL FIRST ??
//process form fields
}

Please advise. Thanks!!

 

		
---------------------------------
Do you Yahoo!?
vote.yahoo.com - Register online to vote today!

Re: file item is always processed last in commons upload?

Posted by Martin Cooper <mf...@gmail.com>.
On Wed, 20 Oct 2004 10:40:26 -0700 (PDT), Joe Smith <ap...@yahoo.com> wrote:
> 
> I want to know if file item (<input type="file">) is always being processed last using commons upload?
> 

The items are processed in the order in which they appear in the
request, which is the same order in which they appear in the HTML form
that was submitted.

--
Martin Cooper


> For the following code, it always process form fields first. Is that always true? That's my observations.
> 
> if (!item.isFormField())
> {
> //CALL SECOND ??
> //process file item
> }
> else
> {
> //CALL FIRST ??
> //process form fields
> }
> 
> Please advise. Thanks!!
> 
> 
> ---------------------------------
> Do you Yahoo!?
> vote.yahoo.com - Register online to vote today!
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: FileItem.getSize() == 0 Question

Posted by Michael McGrady <mi...@michaelmcgrady.com>.
Hello, Martin,

I definitely am not the least bit interested in any "shooting match" 
over this, but I think you may be mistaken.  I have an implementation 
which utilizes the default file item.  I set the DiskFileUpload file 
threshold at 4096.   But, I still upload files with nothing "in them", 
i.e. size 0.  This is, so far as I can tell, because When the disk file 
upload is used to parse the request, the FileUploadBase ultimately does 
the parsing, and the file upload base seems not to emply the file 
threshold setting.  Isn't this right?  If not, I would definitely like 
to know (A) why not?  and (B) why does a file with a size of 0 get 
uploaded when the threshold is set at 4096?

Michael McGrady

Martin Cooper wrote:

>On Wed, 20 Oct 2004 11:27:40 -0700 (PDT), Joe Smith <ap...@yahoo.com> wrote:
>  
>
>>If FileItem.getSize() == 0, it means either
>>1) The file doesn't exist
>>2) The file exists, but empty file.
>>    
>>
>
>This isn't completely accurate. The fact that the FileItem exists
>means that the client (usually a browser) submitted a multipart part
>for it. If the size is zero, as determined by getSize(), then the
>client submitted a zero-length part (i.e. submitted no data for that
>part).
>
>Recall that a FileItem may or may not be backed by a file in the file
>system. That is determined by the particular FileItem implementation.
>The default implementation stores file item data on disk only if the
>size exceeds a configurable threshold, which all but precludes empty
>files.
>
>--
>Martin Cooper
>
>
>  
>
>>My question is if there are other ways to distinguish 2 cases?
>>
>>Please advise. Thanks!!
>>
>>
>>---------------------------------
>>Do you Yahoo!?
>>vote.yahoo.com - Register online to vote today!
>>
>>    
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
>
>
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: FileItem.getSize() == 0 Question

Posted by Martin Cooper <mf...@gmail.com>.
On Wed, 20 Oct 2004 11:27:40 -0700 (PDT), Joe Smith <ap...@yahoo.com> wrote:
> 
> If FileItem.getSize() == 0, it means either
> 1) The file doesn't exist
> 2) The file exists, but empty file.

This isn't completely accurate. The fact that the FileItem exists
means that the client (usually a browser) submitted a multipart part
for it. If the size is zero, as determined by getSize(), then the
client submitted a zero-length part (i.e. submitted no data for that
part).

Recall that a FileItem may or may not be backed by a file in the file
system. That is determined by the particular FileItem implementation.
The default implementation stores file item data on disk only if the
size exceeds a configurable threshold, which all but precludes empty
files.

--
Martin Cooper


> 
> My question is if there are other ways to distinguish 2 cases?
> 
> Please advise. Thanks!!
> 
> 
> ---------------------------------
> Do you Yahoo!?
> vote.yahoo.com - Register online to vote today!
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


FileItem.getSize() == 0 Question

Posted by Joe Smith <ap...@yahoo.com>.
If FileItem.getSize() == 0, it means either
1) The file doesn't exist
2) The file exists, but empty file.

My question is if there are other ways to distinguish 2 cases? 

Please advise. Thanks!!

		
---------------------------------
Do you Yahoo!?
vote.yahoo.com - Register online to vote today!