I may have a tidy solution to the multipart/form-data problem posed by
Gunnar Ole Skogen, using the HTTPClient classes from Ronald Tschal�r
(http://www.innovation.ch/java/HTTPClient/) a block of code such as
below may be used to construct a multipart test example.

import HTTPClient.Codecs;
import HTTPClient.NVPair;
.
.
.
NVPair[] hdrs = new NVPair[1];

public void beginUpload(WebRequest theRequest) 
{
  NVPair[] opts = { new NVPair("option", "myoption") };
  NVPair[] file = { new NVPair("comment", "/home/alan/src.zip") };
  try {
    byte[] data = Codecs.mpFormDataEncode(opts, file, hdrs);
    InputStream i = new ByteArrayInputStream(data);
    theRequest.setUserData(i);
    theRequest.setContentType(hdrs[0].getValue());
    i.close();
  } catch (IOException e) {
    System.out.println("Error Building Multipart");
  }
}

If this helps anyone, please let me know - I would be happy to write up
a more detailed explanation for inclusion in the docs

Alan Perfect
DigitalMonkey
www.digitalmonkey.co.uk


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

Reply via email to