There are two common causes for this error.
Firstly, it might simply mean that you do not have the Commons IO
jar in your classpath. FileUpload depends on IO (see
dependencies) - you can tell if
this is the case if the missing class is within the
org.apache.commons.io
package.
Secondly this happens when attempting to rely on a shared copy of the Commons FileUpload jar file provided by your web container. The solution is to include the FileUpload jar file as part of your own web application, instead of relying on the container. The same may hold for FileUpload's IO dependency.
String fileName = item.getName(); if (fileName != null) { filename = FilenameUtils.getName(filename); }