http://jakarta.apache.org/commons/httpclient/3.0/index.html
But what I see the new is 3.0. what is different is 2.0 and 3.0 On Sun, 10 Oct 2004 23:12:15 -0700 (PDT), Srinivas Velidanda <[EMAIL PROTECTED]> wrote: > Hi, > > I have been using HttpClient version 2.0.1. But have some problems while uploading > multiple files. Please let me know > > 1. Can I upload multiple files using httpclient api from client to server (client > and server running on different systems). > > 2. I worked with sample code at > > http://www.theserverside.com/articles/article.tss?l=HttpClient_FileUpload. > Everything works fine if I run the sample on the same systems but I cannot do the > same by making the client and server on different systems. > > I used the following sample at the above url > > Listing 9-6. HttpMultiPartFileUpload.java > package com.commonsbook.chap9; > import java.io.File; > import java.io.IOException; > > import org.apache.commons.httpclient.HttpClient; > import org.apache.commons.httpclient.methods.MultipartPostMethod; > > public class HttpMultiPartFileUpload { > private static String url = > "http://localhost:8080/HttpServerSideApp/ProcessFileUpload.jsp"; > > public static void main(String[] args) throws IOException { > HttpClient client = new HttpClient(); > MultipartPostMethod mPost = new MultipartPostMethod(url); > client.setConnectionTimeout(8000); > > // Send any XML file as the body of the POST request > File f1 = new File("students.xml"); > File f2 = new File("academy.xml"); > File f3 = new File("academyRules.xml"); > > System.out.println("File1 Length = " + f1.length()); > System.out.println("File2 Length = " + f2.length()); > System.out.println("File3 Length = " + f3.length()); > > mPost.addParameter(f1.getName(), f1); > mPost.addParameter(f2.getName(), f2); > mPost.addParameter(f3.getName(), f3); > > int statusCode1 = client.executeMethod(mPost); > > System.out.println("statusLine>>>" + mPost.getStatusLine()); > mPost.releaseConnection(); > } > } > > and for processing file upload i used the following JSP > > <%@ page contentType="text/html;charset=windows-1252"%> > <%@ page import="org.apache.commons.fileupload.DiskFileUpload"%> > <%@ page import="org.apache.commons.fileupload.FileItem"%> > <%@ page import="java.util.List"%> > <%@ page import="java.util.Iterator"%> > <%@ page import="java.io.File"%> > html> > <head> > <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> > <title>Process File Upload</title> > </head> > <% > System.out.println("Content Type ="+request.getContentType()); > > DiskFileUpload fu = new DiskFileUpload(); > // If file size exceeds, a FileUploadException will be thrown > fu.setSizeMax(1000000); > > List fileItems = fu.parseRequest(request); > Iterator itr = fileItems.iterator(); > > while(itr.hasNext()) { > FileItem fi = (FileItem)itr.next(); > > //Check if not form field so as to only handle the file inputs > //else condition handles the submit button input > if(!fi.isFormField()) { > System.out.println("\nNAME: "+fi.getName()); > System.out.println("SIZE: "+fi.getSize()); > //System.out.println(fi.getOutputStream().toString()); > File fNew= new File(application.getRealPath("/"), fi.getName()); > > System.out.println(fNew.getAbsolutePath()); > fi.write(fNew); > } > else { > System.out.println("Field ="+fi.getFieldName()); > } > } > %> > <body> > Upload Successful!! > </body> > </html> > > 3. But I could not do the same by making the server and client on different systems. > > 4. Pl. let me know for the same purpose is there any patch available with current > version released. i.e.2.0.2 > > 5. Is there a way to build Multipart request without putting the Http File Item in > the form. > i.e. dynamically getting the file Items created programmatically at client side > and > passing the Multipart request to the server > > thanks, > Srinivas. > > > Michael Becke <[EMAIL PROTECTED]> wrote: > The Jakarta Commons team is pleased to announce the release of > HttpClient 2.0.2. This release greatly improves the performance of > executing methods where the response contains little or no content. > Please visit the HttpClient 2.0 web site > for more information on > HttpClient and this release. > > Thank you, > > Commons HttpClient Development Team > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > -- Javen Fang - www.matrix.org.cn -------------------------------------- Just for fun - Just do it --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]