Hi Guys, I want my webserver to have "file upload" capabilities. Can I use Tomcat webserver in this case? Also, i don't know how to retrieve the attached file/s from client to the server (servlet). can anyone help me on this? pls provide code snippets if possible. thanks. Jonathan
Jonathan, here's code for file upload. HTML: <form ENCTYPE="multipart/form-data" action="/servlet/FileUpLoad" method="POST"> <input name='upfile' type='file'> <input type="submit" name="Upload" value="Transfer the file"> </form> JavaCode: int iTotalBytes = this.oRequest.getContentLength(); BufferedReader oInFileData= new BufferedReader( new InputStreamReader(this.oRequest.getInputStream())); char[] arData = new char[iTotalBytes]; oInFileData.read(arData); arData contains the contents of the file as well as some more information regarding the request. you can filter out what you need from the array. Hope this helps Satish
You can also obtain the O'reilly multi-part request handler (which parses an enctype of multipart that file-uploading requires). You can find the library at www.servlets.com.