Hi Roland,
Thanks for your reply, I was wondering if you would you be able to elaborate
a little more on this solution? This is my main method for sending the
files:
public int sendFile(String theFile){
int result = -1;
try {
targetFile = new File(theFile);
filePost = new PostMethod("
http://localhost:8084/UploadServer/UploadServer.jsp");
Part[] parts = {new FilePart(targetFile.getName(), targetFile)};
filePost.setRequestEntity(new MultipartRequestEntity(parts,
filePost.getParams()));
HttpClient client = new HttpClient();
client.getHttpConnectionManager
().getParams().setConnectionTimeout(5000);
iStatus = client.executeMethod(filePost);
if (iStatus == HttpStatus.SC_OK) {
System.out.println("Upload complete, response=" +
filePost.getResponseBodyAsString());
} else {
System.out.println("Upload failed, response=" +
HttpStatus.getStatusText(iStatus));
}
} catch (java.net.ConnectException ex){
iStatus = 22;
ex.printStackTrace();
}
catch(IOException e2){;}
finally {
filePost.releaseConnection();
}
result = iStatus;
return result;
}
This code works fine, however I have no way of knowing how many bytes
have been transferred as I would like to have a progress bar showing the
status.
Any help is truly appreciated!
Thanks
Dean Krueger
On 4/4/06, Roland Weber <[EMAIL PROTECTED]> wrote:
Hello Dean,
> Any thoughts on how I could track the upload, or do it another way?
You have to implement your own RequestEntity to track the upload.
It can be a wrapper around the MultipartRequestEntity you're using.
You'll also find this discussed in the mailing list archives,
though I'm not sure whether on the user or developer list.
hope that helps,
Roland
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]