1

I uploaded a file to a PHP server using android-async-http:

AsyncHttpClient client = new AsyncHttpClient();
AsyncHttpResponseHandler httpResponseHandler = createHTTPResponseHandler();
File file =new File(filePath);
RequestParams params = new RequestParams();
params.put("data", file); 
client.post(context, url, params, httpResponseHandler);   

This works fine WITH PROGRESS,

But when I use these code to upload a file to a .NET server it DOESN'T WORK, I solved it by putting a file in HttpEntity like this:

HttpEntity entity = new FileEntity(file, "multipart/form-data");
client.post(context, url, entity, "multipart/form-data", httpResponseHandler);

It worked fine WITH NO PROGRESS, JUST ONE FLUSH.

I need to show progress while is the file uploading. Thanks.

Brandon Zamudio
  • 2,853
  • 4
  • 18
  • 34
Mohammed hmedat
  • 83
  • 1
  • 11

0 Answers0