Hello, I am doing an upload of my applet has my website,
I works very well but I do not like putting a bar of Progress! (JPROGRESSBAR)!
CAN PLEASE HELP ME!
UPLOAD MY CODE!
String targetURL = "http://localhost/swfupload/demos/swfobjectdemo/upload. aspx";
PostMethod filePost = new PostMethod(targetURL);
filePost.getParams().setBooleanParameter(HttpMethodParams.US E_EXPECT_CONTINUE,true);
try {
File targetFile = new File("C:\\temp\\pruebas\\1_MOV01114.rar"); // FICHERO
UploadFichero.consola("Uploading " + targetFile.getName() + " to " + targetURL);
Part[] parts = {new FilePart("file", targetFile)}; //PARAMETROS
filePost.setRequestEntity(
&nbs p; new MultipartRequestEntity(parts,
&nbs p; filePost.getParams())
&nbs p; );
HttpClient client = new HttpClient();
client.getHttpConnectionManager().getParams().setConnectionT imeout(50000);
// ----------------------
// ----------------------
// HE IS DOING IN THIS LINE THE UPLOAD! HERE I HAVE TO MAKE THE CHANGE FOR PROGRESS, BUT HOW AND WHERE?
int status = client.executeMethod(filePost);
if (status == HttpStatus.SC_OK) {
&nbs p; UploadFichero.consola("Upload complete, response=" + filePost.getResponseBodyAsString() );
} else {
&nbs p; UploadFichero.consola("Upload failed, response=" + HttpStatus.getStatusText(status) );
}
} catch (Exception ex) {
UploadFichero.consola("Error: " + ex.getMessage());
ex.printStackTrace();
} finally {
filePost.releaseConnection();
}