commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Cook <>
Subject Re: FileUpload - read timed out / stream ended unexpectedly
Date Tue, 08 Jul 2003 14:53:08 GMT
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.


    // Read the parameter/item that should hold the file name
    String itemName = item.getName();
    // Check to see if the file name is blank.
    // for some reason doing an if compare to null did not work for
    // me
    {System.err.println("Oppsss no file to upload");}
    {			// Open else in readParam method
         System.out.println("If triggered");
         File fullFile = new File(itemName);
         File savedFile = new 	 
         System.out.println("Ok, the file should have been written 
    }  			// Close else in readP

View raw message