Hello Jeffrey,

>   public static void main(String[] args) {
>     ....
>  
>     PostMethod post = new PostMethod(servletPath);
>  
>     try {
>       File tempFile = new File("C:\\0.txt");
> 
>       List<Part> parts = new ArrayList<Part>();
>       parts.add(new FilePart("file", tempFile.getName(), tempFile));
>       MultipartRequestEntity multipartRequestEntity = new
> MultipartRequestEntity(parts.toArray(new Part[0]), post.getParams());
>       post.setRequestEntity(multipartRequestEntity);
>       post.setContentChunked(true);
>       post.setRequestHeader("Content-type", "multipart/form-data");
>       post.setRequestHeader("Content-length", "" +
> multipartRequestEntity.getContentLength());

Do not add either of them.

>  
>       // add parameters
>       post.addParameter("description", "desc");
>       ...

Here, you are *replacing* the multipart request entity by a simple
URL-encoded description=desc name-value-pair. It's either one or
the other, multipart request entity or parameters. Add your name-
value-pairs to the multipart request entity, that's why it's
called multipart :-)

cheers,
  Roland


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to