title: Uploading images to a PHP server from Android
body: <p>I need to upload an image to a remote PHP server which expects the following parameters in HTTPPOST: </p>
  
  <pre><code>*$_POST['title']*
  *$_POST['caption']*
  *$_FILES['fileatt']*
  </code></pre>
  
  <p>Most of the internet searches suggested either :  </p>
  
  <p><strong>Download the following classes and trying MultiPartEntity to send the request:</strong></p>
  
  <pre><code>apache-mime4j-0.5.jar
  httpclient-4.0-beta2.jar
  httpcore-4.0-beta3.jar
  httpmime-4.0-beta2.jar
  </code></pre>
  
  <p>OR  </p>
  
  <p><strong>Use URLconnection and handle multipart data myself.</strong></p>
  
  <p>Btw, I am keen on using HttpClient class rather than java.net(or is it android.net) classes. Eventually, I downloaded the Multipart classes from the Android source code and used them in my project instead.</p>
  
  <p>Though this can be done by any of the above mentioned methods, I'd like to make sure if these are the only ways to achieve the said objective. I skimmed through the documentation and found a <code>FileEntity</code> class but I could not get it to work.</p>
  
  <p>What is the correct way to get this done in an Android application?</p>
  
  <p>Thanks.</p>