difference between upload image and download image
<p>I wrote an app; it can  upload  and download images. I found one problem: sometimes  uploading an  image doesn't succeed. I restart the phone, and then i can upload images. Downloading images always succeeds. I think apn changed so give me the result, but i am not modify it, I am used default cmnet. iIf i forget something, can you give some advice?</p>

<pre><code>private void postFile() {

HttpClient httpclient = new DefaultHttpClient();
httpclient.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1);

HttpPost httppost = new HttpPost(url[type]);


Bitmap pic1 = ImageFile.decodeFile(currentPath, 180);
currentPath=ConstValue.MY_TEMP_DIR + "/search.jpg";
ImageFile.writePhotoJpg(pic1, currentPath);
File file = new File(currentPath);
//  File file=new File("/mnt/sdcard/aaaa.txt");


FileBody cbFile = new FileBody(file, "image/jpeg");
//FileBody cbFile = new FileBody(file);
MultipartEntity mpEntity = new MultipartEntity();

try {
     mpEntity.addPart("fileToUpload", cbFile);
    //mpEntity.addPart( "fileToUpload",new FileBody(file));

    mpEntity.addPart("sys", new StringBody("android"));
    mpEntity.addPart("sex", new StringBody(sex));
    mpEntity.addPart("ver", new StringBody(ConstValue.VERSION_NAME));
    mpEntity.addPart("uid", new StringBody(ConstValue.UID));
    mpEntity.addPart("page", new StringBody("1"));
    mpEntity.addPart("offset", new StringBody("30"));
} catch (UnsupportedEncodingException e2) {
    // TODO Auto-generated catch block
    e2.printStackTrace();
}

httppost.setEntity(mpEntity);
//Log.d("log", httppost.getRequestLine().toString());
//Log.d("Log", httppost.getEntity().toString());
HttpResponse response = null;
try {
    response = httpclient.execute(httppost);
    Log.i("log","111111111111111");
} catch (ClientProtocolException e1) {
    // TODO Auto-generated catch block
    e1.printStackTrace();
    Log.i("log","2222222222222");
} catch (IOException e1) {
    // TODO Auto-generated catch block
    e1.printStackTrace();
    Log.i("log","33333333333");
}
HttpEntity resEntity = response.getEntity();


if (resEntity != null) {
    try {
        final String response_str = EntityUtils.toString(resEntity);
        Log.i("log",""+response_str);
        if (!response_str.contains("@@@@")) {
            ConstValue.COUPLE_MATCH_RESAULT = ApplyXmlUtil.parseMastersXML(response_str);
        } else {

            errerCode=0;
        }

        // Log.d("log", response_str);
    } catch (ParseException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}else{

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

<p>}</p>

<p>My download code didn't use the  DefaultHttpClient; it is a commom httpconnection.</p>
