title: Android Image resize (resample/downsample) before uploading
body: <pre><code>private void doFileUpload(){
  
      File file1 = new File(selectedPath1);
  
      String urlString = "http://example.com/upload_media_test.php";
      try
      {
           HttpClient client = new DefaultHttpClient();
           HttpPost post = new HttpPost(urlString);
           FileBody bin1 = new FileBody(file1);
  
           MultipartEntity reqEntity = new MultipartEntity();
           reqEntity.addPart("uploadedfile1", bin1);
           reqEntity.addPart("user", new StringBody("User"));
           post.setEntity(reqEntity);
  
           HttpResponse response = client.execute(post);
           resEntity = response.getEntity();
           final String response_str = EntityUtils.toString(resEntity);
  
           if (resEntity != null) {
               Log.i("RESPONSE",response_str);
               runOnUiThread(new Runnable(){
                      public void run() {
                           try {
                              res.setTextColor(Color.GREEN);
                              res.setText("n Response from server : n " + response_str);
                              Toast.makeText(getApplicationContext(),"Upload Complete. Check the server uploads directory.", Toast.LENGTH_LONG).show();
                          } catch (Exception e) {
                              e.printStackTrace();
                          }
                         }
                  });
           }
      }
      catch (Exception ex){
           Log.e("Debug", "error: " + ex.getMessage(), ex);
      }
    }
  </code></pre>
  
  <p>I get this code from internet. it's work but when I try upload bigger file than 1Mbyte,</p>
  
  <p>I face an error with filesize.</p>
  
  <p>I know how to resize bitmap images and but I have no idea upload the resized bitmap image.</p>
  
  <p>how can I resize and upload with filebody?</p>
  
  <p>Thanks in advance</p>