Hi,
I have been trying to write a servlet which will
upload a file to the server.For that i used oreilly's
MultiPartRequest class.Iam sending data through HTTP
header like that:-
url = new URL
("http://127.0.0.1:7001/FileUpload?x="+str1);
urlConn = url.openConnection();
urlConn.setDoInput (true);
urlConn.setDoOutput (true);
urlConn.setUseCaches (false);
urlConn.setRequestProperty("Content-Type","multipart/form-data;boundary=-----------------------------7d01ecf406a6");
printout = new DataOutputStream
(urlConn.getOutputStream ());
String
content="-----------------------------7d01ecf406a6\r\n"+"Content-Disposition:
form-data;"+"name=\"upload\";
filename=\""+aa+"\"\r\n"+"Content-Type:
application/octet-stream\r\n\r\n\r\n"+conffile+"-----------------------------7d01ecf406a6--\r\n";
But i get the following exception:-
java.io.IOException: Corrupt form data: no leading
boundary
at
com.oreilly.servlet.MultipartRequest.readRequest(MultipartRequest.java:361)
at
com.oreilly.servlet.MultipartRequest.<init>(MultipartRequest.java:149)
at FileUpload.doPost(FileUpload.java:23)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:213)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:1265)
at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:1622)
at
weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
at
weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
Regards
Bikash
__________________________________________________
Do You Yahoo!?
Buy the perfect holiday gifts at Yahoo! Shopping.
http://shopping.yahoo.com
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html