4 Replies Latest reply: Jun 19, 2008 9:00 AM by 807591 RSS

    File upload

    807591
      html file input is the only solution for uploading data. Is there any alternate solution for uploading data.
        • 1. Re: File upload
          807591
          Hi

          Can i know why you are looking for other solution? i am asking you because HTML is a code that interpreted by any of the browser. so that is standard Input Language.

          Regards
          Jaydeep
          • 2. Re: File upload
            807591
            Lookup the Apache Commons FileUpload API: [http://commons.apache.org/fileupload].

            You can find here a very useful Filter example which handles multipart request fully transparantely for you. It puts all request parameters back in the parameterMap of the HttpServletRequest and it puts all uploaded files in the attributeMap of the HttpServletRequest (so that you can get it by request.getAttribute("fieldname")). This way you can just continue writing servlet code as usual: [http://balusc.blogspot.com/2007/11/multipartfilter.html].
            • 3. Re: File upload
              800321
              Well I need more detail on your problem. This question might be better suited to the Networking forum. What you might need is to use Sockets. A socket is an object that can connect to a host and a port. Then you can use methods in your socket to get input and output streams. A socket can be used to send almost any data you want.
              //Connects to the hose www.google.com on port 80 which is the default port of the HTTP protocol.
              Socket s = new Socket("www.google.com", 80);
              InputStream in = s.getInputStream();
              //Now this input stream works like any other one
              //You can also use getOutputStream() to create an output stream
              s.close();//closes the Connection
              • 4. Re: File upload
                807591
                D'oh. He is clearly talking about a "html file input". It's not rocket science.

                After all, he is posting this in a wrong forum. In the future, please post JSP related questions at the JSP forum: [http://forum.java.sun.com/forum.jspa?forumID=45].