I have four images which I want to send to server through my application. Here is my code for send data to sever along with the four images but I can't understand how can I send these images of mine to server:
{
String imageUrl1 = selectedImagePath1;
aq.id(imageview1).image(imageUrl1, true, true, 200, 0);
String imageUrl2 = selectedImagePath2;
aq.id(imageview2).image(imageUrl2, true, true, 200, 0);
String imageUrl3 = selectedImagePath3;
aq.id(imageview3).image(imageUrl3, true, true, 200, 0);
String imageUrl4 = selectedImagePath4;
aq.id(imageview4).image(imageUrl4 ,true, true, 200, 0);
new GetData().execute();
}
private class GetData extends AsyncTask<String, String, String>
{
@Override
protected String doInBackground(String... params)
{
String Title = title.getText().toString();
String Description = description.getText().toString().trim();
String PhoneNumber = phonenumber.getText().toString();
String Email = email.getText().toString();
String Price = price.getText().toString();
try
{
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpGet httpget = new HttpGet("http://tradewale.com/open/tradedata.php?home_cat=1");
HttpResponse response = httpclient.execute(httpget);
BufferedReader in = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
StringBuffer sb = new StringBuffer("");
String line = "";
String NL = System.getProperty("line.separator");
while ((line = in.readLine()) != null)
{
sb.append(line + NL);
}
in.close();
String result = sb.toString();
System.out.println(result);
JSONObject obj = new JSONObject(result);
value = obj.getString("Success");
}
catch (Exception e)
{
e.printStackTrace();
}
return value;
}
@Override
protected void onPostExecute(String result)
{
int val=Integer.parseInt(value);
if (val==1)
{
Toast.makeText(PostAddActivity.this, "Thank you For Inquiry ",
Toast.LENGTH_LONG).show();
finish();
}
else
{
Intent in = new Intent(getApplicationContext(), PostAddActivity.class);
startActivity(in);
}
}
}