• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Receiving multipart request

 
Lloyd Lamington
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have written a code to upload the files to a server on the client side using multipart.. I would like to know how to receive these files on the server side. Can anybody provide me with the sample code ?

Thanks,
Lloyd
 
ujjwal soni
Ranch Hand
Posts: 403
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

As you are uploading the files from client to the server, your files are already recieved on the server.
 
Lloyd Lamington
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am actually running a servlet on my machine to get the multipart request. I need to write the code to get the multipart request in the servlet.

Thanks
 
ujjwal soni
Ranch Hand
Posts: 403
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did'nt get you. You are saying that you want a servlet on server side that handles multipart requests but you are currently doing this locally on your machine then, why dont you write your servlet code running locally into the servlet thats running on the server ?
 
Tim McGuire
Ranch Hand
Posts: 820
IntelliJ IDE Tomcat Server VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try using apache commons fileupload.
read here all about file upload


in your servlet
import org.apache.commons.fileupload.*;





To use the "FileItems" in items, you would iterate through the list and check each item to see if it is a form field or not.
contents form fields would get processed as strings. non-form fields can be treated as files. uploaded files should be saved using streams instead of trying to store the contents in memory.

again, the link explains everything, including tracking progress of uploads, dealing with antivirus scanners, and cleaning up temp files. enjoy.
 
Charbel Keyrouz
Ranch Hand
Posts: 46
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
check this site as well (oreilly's cos.jar)
http://www.jguru.com/faq/view.jsp?EID=1045507
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic