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.

Example:

// 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
if(itemName.length()<2)
{System.err.println("Oppsss no file to upload");}
else
{ // Open else in readParam method
System.out.println("If triggered");
File fullFile = new File(itemName);
File savedFile = new File(getServletContext().getRealPath("/"),fullFile.getName());
item.write(savedFile);
System.out.println("Ok, the file should have been written somewhere....");
} // Close else in readP



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to