user584513
user584513

Reputation: 630

UploadFileAsync in Java?

How can I upload file to a server (API interface) in Java, just like the .NET programmers do in C#:

cli.UploadFileAsync(URL, filename);

Tried to do findout a way by using HttpClient but no success.

Upvotes: 0

Views: 72

Answers (1)

cheekoo
cheekoo

Reputation: 877

I believe async http client is what you are looking for. Read through the docs and I am sure you can find your way.

AsyncHttpClient client = new AsyncHttpClient();
Response response =
   client.preparePut(("http://sonatype.com/myFile.avi").execute();

Another blog explaining its usage: http://jfarcand.wordpress.com/2010/12/21/going-asynchronous-using-asynchttpclient-the-basic/

Upvotes: 1

Related Questions