Android - Upload Large image to server
<p>I am trying to have my application upload images to the webserver using the code below. It works sometimes, but also seems to fail with a memory error. Can someone please post an example of how to accomplish this if the file size is to big? Also, I am building this to support 1.5 and up. I don't mind if the code given to me resizes the image smaller before upload.</p>

<pre><code>HttpClient httpclient = new DefaultHttpClient();

HttpPost httppost = new HttpPost(urlString);

File file = new File(nameOfFile);

FileInputStream fileInputStream = new FileInputStream(file);
InputStreamEntity reqEntity = new InputStreamEntity(fileInputStream, file.length());

httppost.setEntity(reqEntity);
reqEntity.setContentType("binary/octet-stream");
HttpResponse response = httpclient.execute(httppost);
HttpEntity responseEntity = response.getEntity();

if (responseEntity != null) {
    responseEntity.consumeContent();
}

httpclient.getConnectionManager().shutdown();
</code></pre>
