If you do it like that, the whole POST must be buffered in memory.
This is because it needs to send the Content-Length header first.
Instead, I think you want to use the Apache HTTP libraries, including
http://developer.android.com/reference/org/apache/http/entity/FileEntity.html
. That will let it figure out the length before reading the file. You
can use this answer as a starting point. But the second parameter to
the FileEntity constructor should be a mime type (like image/png,
text/html, etc.).
Posting a large file in Android
Check This also .........
As Schnapple says your question seems very broad and is confusing to read and understand.
Here is some general code to send a HTTP POST and get a response from a server though that may be helpful.
public String postPage(String url, File data, boolean returnAddr) {
ret = null;
httpClient.getParams().setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.RFC_2109);
httpPost = new HttpPost(url);
response = null;
FileEntity tmp = null;
tmp = new FileEntity(data,"UTF-8");
httpPost.setEntity(tmp);
try {
response = httpClient.execute(httpPost,localContext);
} catch (ClientProtocolException e) {
System.out.println("HTTPHelp : ClientProtocolException : "+e);
} catch (IOException e) {
System.out.println("HTTPHelp : IOException : "+e);
}
ret = response.getStatusLine().toString();
return ret;
}