I have a
<input name="shp_local" id="shp_local" type="file" ></input>
I can upload files of any kind and the temp file generated on the server is correct, but when I upload .zip it generates a bigger and more inconsistent file.
I'm using tomcat 7.0
When uploading larger files I have no problems, apparently this happens only when sending compressed files. To check the information I receive on the server I am using the .tmp file that is generated automatically.
Edit 1
The input is surrounded by a form that launches a servlet, this is the code for processing the file in the servlet
PrintWriter outwr = response.getWriter();
String fileType = null;
String fileName = "";
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
List /* FileItem */items = upload.parseRequest(request);
Iterator iterator = items.iterator();
while (iterator.hasNext()) {
FileItem item = (FileItem) iterator.next();
if (!item.isFormField()) {
InputStream inputStream = item.getInputStream();
StringWriter writer = new StringWriter();
IOUtils.copy(inputStream, writer);
// creem un arxiu temporal
File temp = File.createTempFile("tempfile", ".tmp");
Writer out = new BufferedWriter(
new OutputStreamWriter(
new FileOutputStream(
temp.getAbsolutePath())));
try {
out.write(writer.toString());
} finally {
out.close();
}
fileName = temp.getName();
} else {
fileType = item.getString();
}
}