Hi i have so much googled about image upload from android phone to server and i have done following code
for example
HttpClient httpClient = new DefaultHttpClient(); HttpContext localContext = new BasicHttpContext(); HttpPost httpPost = new HttpPost(url); try { MultipartEntity entity = new MultipartEntity( HttpMultipartMode.BROWSER_COMPATIBLE); for (int index = 0; index < nameValuePairs.size(); index++) { if (nameValuePairs.get(index).getName() .equalsIgnoreCase("image")) { entity.addPart(nameValuePairs.get(index).getName(),new FileBody(new File( nameValuePairs.get( index) .getValue()), "image/jpg")); httpPost.setEntity(entity); HttpResponse httpResponse = httpClient.execute(httpPost, localContext); HttpEntity httpEntity = httpResponse.getEntity(); is = httpEntity.getContent(); Don't know why but image is not uploded to server and i am getting following logcat
05-08 23:20:17.452: I/System.out(2501): Response from serveer <pre>Array 05-08 23:20:17.454: I/System.out(2501): ( 05-08 23:20:17.455: I/System.out(2501): [image] => Array 05-08 23:20:17.455: I/System.out(2501): ( 05-08 23:20:17.455: I/System.out(2501): [name] => IMG_20130101_164850.jpg 05-08 23:20:17.455: I/System.out(2501): [type] => 05-08 23:20:17.455: I/System.out(2501): [tmp_name] => C:\Windows\Temp\php5CD4.tmp 05-08 23:20:17.456: I/System.out(2501): [error] => 0 05-08 23:20:17.456: I/System.out(2501): [size] => 1988151 05-08 23:20:17.456: I/System.out(2501): ) 05-08 23:20:17.456: I/System.out(2501): ) Here from server TYPE is returning no value so i can not give update
Please anybody can help about this problem