0

I tried to download [httpmime-4.0.1.jar] but still the error is there and -------------------------------

class ImageUploadTask extends AsyncTask { @Override

    protected String doInBackground(Void... unsued) {

        try {

            HttpClient httpClient = new DefaultHttpClient();





HttpContext localContext = new BasicHttpContext();
            HttpPost httpPost = new HttpPost(getString(R.string.WebServiceURL) + "/cfc/iphonewebservice.cfc?method=uploadPhoto");
            MultipartEntity entity = new MultipartEntity(

         HttpMultipartMode.BROWSER_COMPATIBLE);





ByteArrayOutputStream bos = new ByteArrayOutputStream();
            bitmap.compress(CompressFormat.JPEG, 100, bos);
            byte[] data = bos.toByteArray();
            entity.addPart("photoId", new StringBody(getIntent()



.getStringExtra("photoId")));
            entity.addPart("returnformat", new StringBody("json"));
            entity.addPart("uploaded", new ByteArrayBody(data,"myImage.jpg"));



    entity.addPart("photoCaption", new StringBody(caption.getText().toString()));
            httpPost.setEntity(entity);
            HttpResponse response = httpClient.execute(httpPost,
   localContext);

2 Answers 2

2

Add a libs folder in your application then add “httpmime-4.1.3.jar”, after that you need to show this directory to your project properties.

Sign up to request clarification or add additional context in comments.

Comments

0

You should add this JAR to build path. If you are using Eclipse just copy it to project folder. Then in Eclipse right mouse click on it, BUILD PATH->ADD TO BUILD PATH

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.