나는 [httpmime-4.0.1.jar]을 다운로드하려고했으나 여전히 오류가 있으며 ---------------------------- ---"import org.apache.http.entity.mime.content.ByteArrayBody;"에서 오류를 제거하는 방법
클래스 ImageUploadTask 당신은 경로를 구축하기 위해이 JAR을 추가해야 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);
시도했지만 오류가 있습니다. – DaChavoh