Even if the file is cached if there is a file attach input field in a page that is not filled in. It will return a blank value that will cause a FileUpLoadException
Try making the following change:
Original
else {
> // save item to a HashMap for later processing
> fileUploadItems.put(item.getFieldName(), item);
> }
Changed else { // Opens else //This if tests to see if a file name was returned // if a file name was retuned then // fileUploadItems is called to read it. if((itme.getName).length()>2){ // Opens if
> // save item to a HashMap for later processing > fileUploadItems.put(item.getFieldName(), item); > } // Closes if > } // Closes else
> "Jakarta Commons Users List" <[EMAIL PROTECTED]> writes:
>
>>It sounds like the file attachment fields in your HTML are being left
>>blank. I.E. the user is clicking the submit button with out attaching a
>>file. This returns the file parameter(or item) as blank and throws a
>>FileUploadException.
>>
>>You will need to throw in a condition to check to see if the file name
>>is blank and if so not call the method that does the uploading.
>>
>
> The page works fine (on my development setup and most produciton machines)
> without uploading anything. My framework "caches" the uploads for later
> processing. Here's my parsing code (within a wrapper of the request):
>
> DiskFileUpload upload = new DiskFileUpload();
> List items = upload.parseRequest(this, memoryLimit, fileSizeLimit,
> savePath); // this line fails occasionally
> Iterator iter = items.iterator();
> while (iter.hasNext()) {
> FileItem item = (FileItem) iter.next();
> if (item.isFormField()) {
> String key = item.getFieldName();
> String value = item.getString();
> setParameter(key, value, false);
> } else {
> // save item to a HashMap for later processing
> fileUploadItems.put(item.getFieldName(), item);
> }
> }
>
> It's the second line that is failing (when it does, which is never unless
> you happen to be on this one problem machine).
>
> Do you see a place in here where the solution you suggested could be
> applied?
>
> Thanks for the help.
>
>
> Daryl Stultz
> _____________________________________
> 6 Degrees Software and Consulting, Inc.
> http://www.6degrees.com
> mailto:[EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
