commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daryl Stultz" <>
Subject Re: FileUpload - read timed out / stream ended unexpectedly
Date Tue, 08 Jul 2003 15:08:38 GMT
"Jakarta Commons Users List" <> 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 
>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);
	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

Thanks for the help.

Daryl Stultz
6 Degrees Software and Consulting, Inc.

View raw message