req.setCharacterEncoding("UTF-8");
ServletFileUpload upload = new ServletFileUpload();
// Parse the request
FileItemIterator iter;
String kind = null;
String key = null;
String parentKey = null;
HashMap<String, UploadStatus> uploadStatuses = new HashMap<String, UploadStatus>();
HashMap<String, ByteArrayHolder> uploadContents = new HashMap<String, ByteArrayHolder>();
HashMap<String, String> regularProperties = new HashMap<String, String>();
try {
iter = upload.getItemIterator(req);
while (iter.hasNext()) {
FileItemStream item = iter.next();
String fieldName = item.getFieldName();
InputStream stream = item.openStream();
if (item.isFormField()) {
String value = Streams.asString(stream, "UTF-8");
System.out.println("Form field " + fieldName + " with value "