File Upload using MultipartRequest.
843840Aug 1 2001 — edited Aug 8 2001Although file gets uploaded successfully, I get the following WARNING message in my log file when ran on NT/2000 which is okay.
The message says:
"One of the getParameter family of methods called after reading from the ServletInputStream, not merging post parameters".
But when I run the same code on UNIX it gives me an ERROR message. (message same as above). That crahes my JSP in the UNIX enviro. Any idea why does this happen? pl. let me know ASAP.
My production environment is UNIX based.
Here goes the code that I wrote.
<form name="myform" method="post" action="upload_file.jsp" enctype="multipart/form-data">
<table border="1" bordercolor="white" cellspacing="1" cellpadding="2" align="center" bgcolor="#c9dced">
<% for (int i=1; i<=5; i++) { %>
<tr>
<td>
<font face="Arial, Helvetica, sans-serif" size="1">Document</font>
<input type="file" name=<%="\"documentNameTF" + i + "\""%> maxlength="100" size="30">
</td>
</tr>
<% } // end for %>
<tr>
<td colspan="2" align="center">
<input type="button" name="saveBTN" value="Add Documents" onClick="document.myform.submit()">
</td>
</tr>
</table>
</form>
file2: upload_file.jsp
<%if (request.getContentType().startsWith("multipart/form-data",0)) {
com.oreilly.servlet.MultipartRequest multi = new com.oreilly.servlet.MultipartRequest(request, path ,MAX_FILE_SIZE);
/* Retrieve Parameters from multi */
for (int i=1; i<=5; i++) {
if (multi.getFilesystemName("documentNameTF" + i) != null) {
slDocUrl = multi.getFilesystemName("documentNameTF1");
} else {
slDocUrl = "";
}
} // end for 1-5
multi = null;
}
%>
Thanks,
Rakesh.