problem on sending file to server in android..formated code
<pre><code>public class Sendfile extends Activity 
{

/** Called when the activity is first created. */

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

String url = "http://http://192.168.0.158:4299";

File file = new File(Environment.getExternalStorageDirectory(),
    "sendingfile.txt");

try {
   HttpClient httpclient = new DefaultHttpClient();

HttpPost httppost = new HttpPost(url);
   InputStreamEntity reqEntity = new InputStreamEntity(
     new FileInputStream(file), -1);

reqEntity.setContentType("binary/octet-stream");

reqEntity.setChunked(true);

// Send in multiple parts if needed

httppost.setEntity(reqEntity);

HttpResponse response = httpclient.execute(httppost);

Toast.makeText(getApplicationContext(), response.toString(),
     Toast.LENGTH_LONG).show();
   // Do something with response...
  } catch (Exception e) {
   // show error
  }

 }
}
</code></pre>
