title: Upload picture to server
body: <p>I've googled a lot but it doesn't work. I found a lot of sites with information but by all the sites my app crashed. The picture that I want to open is: "lastfile.png". It is stored in internal storage so I open it with openFileInput("lastfile.png");</p>
  
  <p>I do it in in an AsyncTask.</p>
  
  <p>This is my code so far:</p>
  
  <pre><code>class PostTask extends AsyncTask&lt;String, String, String&gt;{
          @Override
          protected String doInBackground(String... uri) {
              if(picture == null) {
                  HttpClient httpclient = new DefaultHttpClient();
                  HttpResponse response;
                  String responseString = null;
                  try {
                      response = httpclient.execute(new HttpGet(uri[0]));
                      StatusLine statusLine = response.getStatusLine();
                      if(statusLine.getStatusCode() == HttpStatus.SC_OK){
                          ByteArrayOutputStream out = new ByteArrayOutputStream();
                          response.getEntity().writeTo(out);
                          out.close();
                          responseString = out.toString();
                      } else{
                          response.getEntity().getContent().close();
                          throw new IOException(statusLine.getReasonPhrase());
                      }
                  } catch (ClientProtocolException e) {
                      Toast.makeText(AddStoryActivity.this, getResources().getString(R.string.error), Toast.LENGTH_LONG).show();
                      e.printStackTrace();
                  } catch (IOException e) {
                      Toast.makeText(AddStoryActivity.this, getResources().getString(R.string.error), Toast.LENGTH_LONG).show();
                      e.printStackTrace();
                  }
                  return responseString;
              } else {
                  /* IMAGE UPLOAD */
              }
              return "";
          }
  
          @Override
          protected void onPostExecute(String result) {
              super.onPostExecute(result);
              progress.cancel();
              Toast.makeText(getApplicationContext(), result, Toast.LENGTH_LONG).show();       
          }
  
  
      }
  </code></pre>