how to solve java.io.IOException: Corrupt form data: premature ending
843841Oct 22 2004 — edited Jul 10 2008hei evryone!
Does anyone knows how to solve this bug?
java.io.IOException: Corrupt form data: premature ending
Im using Oreilly's cos.jar MultipartRequest
here is my form :
<FORM METHOD="POST" NAME="uploadform" action="mbbfile" ENCTYPE="multipart/form-data">
<TR>
<TD>Select a File:</TD>
<TD><INPUT TYPE="FILE" NAME="srcfile" style="width:400px"/></TD>
</TR>
<TR><TD><INPUT TYPE="SUBMIT" VALUE="Send"/></TD></TR>
</FORM>
HERE IS mbbfile which is a servlet :
package mbb.servlet;
import java.io.IOException;
import java.sql.Connection;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.oreilly.servlet.MultipartRequest;
import org.jconfig.Configuration;
import org.jconfig.ConfigurationManager;
public class MBBFileServlet extends HttpServlet{
private static final Configuration conf = ConfigurationManager.getConfiguration("ConfigFile");
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
String filePath = conf.getProperty("FilePath", "", "test");
try{
MultipartRequest multi = new MultipartRequest(req,filePath,5*1024*1024);
}catch(Exception e){
System.out.println("MBBFileServlet Exception ---> "+e.getMessage());
}
}
public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
doGet(req,res);
}
}
Sometimes it works meaning the file is uploaded in the directory without any exception, sometimes the file is uploaded but with exception on the log saying "MBBFileServlet Exception ---> Corrupt form data: Premature Ending". and sometimes the files is not uploaded at all and when i check the error is : "MBBFileServlet Exception ---> Corrupt form data: Premature Ending". Can anyone please help me on this matter. Thx!
Your response would be deeply appreciated.
br,
TAC