boolean acceptHtml = false;
String acceptHeader = request.getHeader("Accept");
if (acceptHeader != null && acceptHeader.indexOf("text/html") >= 0)
acceptHtml = true;
DiskFileUpload fu = new DiskFileUpload();
// No maximum size
fu.setSizeMax(-1);
// maximum size that will be stored in memory
fu.setSizeThreshold(4096);
// the location for saving data that is larger than getSizeThreshold()
fu.setRepositoryPath(Config.TMP_DIR);
StringWriter messageBuffer = new StringWriter();
PrintWriter messageWriter = new PrintWriter(messageBuffer);
List fileItems = null;
try {
fileItems = fu.parseRequest(request);
} catch (FileUploadException e) {
throw new ServletException(e);
}
// assume we know there are two files. The first file is a small
// text file, the second is unknown and is written to a file on