Hello,
As per my understanding:
You are trying to upload a local file (i.e. c:\temp\my.txt) to another server (
ABC.com).
NOw i am sure your another server must have some servlet to accept uploaded files:
Now please follow below steps:
1) from zimlet JS, accept the local file path (via some dialog)
2) call a JSP by passing this file path
3) now make a PostMethod call to your server (using commons-httpclient)
JSP Sample:
=========
PostMethod filePost = new PostMethod("http://www.abc.com/upload");
filePost.getParams().setBooleanParameter(HttpMetho dParams.USE_EXPECT_CONTINUE, false);
Part[] parts = {new FilePart(filename,filename,new File(filepath))};
filePost.setRequestEntity(new MultipartRequestEntity(parts, filePost.getParams()));
HttpClient client = new HttpClient();
client.getHttpConnectionManager().getParams().setC onnectionTimeout(5000);
// Perform the request
int status = client.executeMethod(filePost);
// Use response to generate data for the zimlet
if (status == HttpStatus.SC_OK) {
String[] serverResponseArr = filePost.getResponseBodyAsString().split(",");
} else {
out.println("Error: " + HttpStatus.getStatusText(status));
}