hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From metalheart2003 <claumarti...@gmail.com>
Subject httpclient - upload progress
Date Wed, 06 May 2009 16:12:12 GMT

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();
}
-- 
View this message in context: http://www.nabble.com/httpclient---upload-progress-tp23410144p23410144.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message