名前DOB idなどの他のエントリを使用してギャラリーを介してサーバーに画像をアップロードしようとしましたが、PHPサーバーの画像を除くすべてのエントリがアップロードされました。私の間違いがどこにあるのかわかりませんでした。別のコードを提案してください。教えてください。ここに私のコードがあります
Bitmap bitmapOrg = BitmapFactory.decodeFile(imageselectedPath1);
ByteArrayOutputStream bao = new ByteArrayOutputStream();
// Resize the image
double width = bitmapOrg.getWidth();
double height = bitmapOrg.getHeight();
double ratio = 400 / width;
int newheight = (int) (ratio * height);
System.out.println("———-width" + width);
System.out.println("———-height" + height);
Log.d("width ", "width " + width);
Log.d("height ", "height " + height);
bitmapOrg = Bitmap.createScaledBitmap(bitmapOrg, 400,
newheight, true);
// Here you can define .PNG as well
bitmapOrg.compress(Bitmap.CompressFormat.JPEG, 99, bao);
byte[] ba = bao.toByteArray();
String ba1 = Base64.encodeBytes(ba);
Log.d("uploading ", "uploading " + ba1);
ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("user_id", mSignMessg));
nameValuePairs.add(new BasicNameValuePair("name", mname.getText().toString()));
nameValuePairs.add(new BasicNameValuePair("dob", mbirthday.getText().toString()));
nameValuePairs.add(new BasicNameValuePair("bio", mbio.getText().toString()));
nameValuePairs.add(new BasicNameValuePair("sex", mSexValue));
nameValuePairs.add(new BasicNameValuePair("profile_status", "0"));
nameValuePairs.add(new BasicNameValuePair("location", mlocation.getText().toString()));
nameValuePairs.add(new BasicNameValuePair("image", ba1));
Log.d("userfile", "userfile " + ba1);
// nameValuePairs.add(new BasicNameValuePair("image”, ba1));
try {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(
"http://iapptechnologies.com/snapic/profileXml.php");
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
Log.d("nameValuePairs", "nameValuePairs " + nameValuePairs);
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
// print responce
outPut = EntityUtils.toString(entity);
Log.i("GET RESPONSE—-", outPut);
Log.d("GET RESPONSE—-", outPut);
// is = entity.getContent();
Log.e("log_tag ******", "good connection");
System.out.println("gudconection");
Log.d("god connection ", "gud connection ");
bitmapOrg.recycle();
} catch (Exception e) {
Log.e("logCatch block***",
"Error in http connection " + e.toString());
Log.d("log_catch block ******", "Error in http connection "
+ e.toString());
}
Log.d("image_name","image_name "+image_name);