title: Upload image from android to python appengine blobstore
body: <p>I have struggled for quite some time to upload photo images from android to python appengine
  This is what I have tried, in Android:</p>
  
  <pre><code>void apachePost()  throws Exception {
      File image = new File("/sdcard/image.jpg");
      HttpClient httpclient = new DefaultHttpClient();
      HttpPost httppost = new HttpPost("http://clockinapple.appspot.com/upload");
      try {
      MultipartEntity entity = new MultipartEntity();
      entity.addPart("type", new StringBody("photo"));
      entity.addPart("data", new FileBody(image));
      httppost.setEntity(entity);
      HttpResponse response = httpclient.execute(httppost);
      Log.v(Constants.DATA, "received http response " + response);
      } catch (ClientProtocolException e){
    }
  }
  </code></pre>
  
  <p>In appengine:</p>
  
  <pre><code>class UserPhoto(db.Model):
      user = db.StringProperty()
      blob_key = blobstore.BlobReferenceProperty()
  
  class UploadHandler(blobstore_handlers.BlobstoreUploadHandler):
      def post(self):
          upload = self.get_uploads()[0]
          user_photo = UserPhoto(user="test", blob_key=upload.key())
          db.put(user_photo)
          return user_photo.key()
  </code></pre>
  
  <p>My logged server error is "Apache-HttpClient/UNAVAILABLE (java 1.4)"</p>
  
  <p>I assume the headers are incorrect - I have tried many variations</p>
  
  <p>Some of the links are have tried:
  <a href="http://pastie.org/1522810" rel="nofollow">Ika Lan's snippet</a></p>
  
  <p><a href="http://blog.tacticalnuclearstrike.com/2010/01/using-multipartentity-in-android-applications/" rel="nofollow">tacticalnuclearstrike blog</a></p>
  
  <p>I would really appreciate any help, I don't seem to be asking the right questions atm </p>