This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Servlets and the fly likes uploading a file to the server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "uploading a file to the server" Watch "uploading a file to the server" New topic
Author

uploading a file to the server

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi buddies,
I have been trying to write a servlet which will upload a file to the server.
For that i used oreilly's MultiPartRequest class, but i get the following exception:
"java.io.IOException: Corrupt form data: no leading boundary at com.oreilly.servlet.MultipartRequest.readRequest(MultipartRequest.java, Compiled Code) at java.lang.Exception.(Exception.java, Compiled Code) at java.io.IOException.(IOException.java, Compiled Code) at com.oreilly.servlet.MultipartRequest.readRequest(MultipartRequest.java, Compiled Code) at com.oreilly.servlet.MultipartRequest.(MultipartRequest.java:140) at Anirban.Wizard.WizardUpload.processRequest(WizardUpload.java:55) at Anirban.Wizard.WizardUpload.doPost(WizardUpload.java:95) at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code) at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code) at com.livesoftware.jrun.JRun.runServlet(JRun.java, Compiled Code) at com.livesoftware.jrun.JRunGeneric.handleConnection(JRunGeneric.java, Compiled Code) at com.livesoftware.jrun.JRunGeneric.handleProxyConnection(JRunGeneric.java, Compiled Code) at com.livesoftware.jrun.service.proxy.JRunProxyServiceHandler.handleRequest(JRunProxyServiceHandler.java, Compiled Code) at com.livesoftware.jrun.service.ThreadConfigHandler.run(ThreadConfigHandler.java, Compiled Code) "
any ideas/help shall be appreciated.
Thanks
ani
henley
Greenhorn

Joined: Jul 06, 2000
Posts: 16
Are you sure that the form has the "multipart/form-data" enctype?
Sharon Adar
Greenhorn

Joined: Apr 29, 2007
Posts: 18
Hi anirban,
Can you tell me where I can get hold of the orielly java class library for use with servlets.
I urgently need to code a servlet to upload files.
Thanks
Sharon
henley
Greenhorn

Joined: Jul 06, 2000
Posts: 16
http://www.servlets.com/resources/com.oreilly.servlet/index.html
Salman Yasser
Greenhorn

Joined: Aug 22, 2002
Posts: 25
I got the same exception when using AppletFile as a client side tool at HTML, but when using the input of type file no error occured
do you face the problem when using input of type file ?
On other hand any body can tell me why the request contains AppletFile generates such exception when trying to make an object of type MultipartRequest
l_MultipartRequest = new MultipartRequest(p_Request,
l_flTempFloder.getCanonicalPath(),
p_nMaximumfileSize); ??
Salman Yasser
Greenhorn

Joined: Aug 22, 2002
Posts: 25
I got the same exception when using AppletFile as a client side tool at HTML, but when using the input of type file no error occured
do you face the problem when using input of type file ?
On other hand any body can tell me why the request contains AppletFile generates such exception when trying to make an object of type MultipartRequest
l_MultipartRequest = new MultipartRequest(p_Request,
l_flTempFloder.getCanonicalPath(),
p_nMaximumfileSize); ??
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
Every one who has posted in this thread.
Welcome to the JavaRanch! Please adjust your display name to meet
the JavaRanch Naming Policy. You can change it here.
Thanks!
and welcome to the JavaRanch!
Salman Yasser
Greenhorn

Joined: Aug 22, 2002
Posts: 25
How could I print the Boundary ? from the request or what ?
 
Consider Paul's rocket mass heater.
 
subject: uploading a file to the server