Note that there are some explanatory texts on larger screens.

plurals
  1. POProblem(Invalid File Response) in Image Upload in android
    text
    copied!<p>Hi Friends i face a problem when i upload the Image the Response come Invalid File so please help for solve this problem.</p> <pre><code> public void executeMultipartPost() throws Exception { try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); MybitmapImage.compress(Bitmap.CompressFormat.JPEG, 75, bos); byte[] data = bos.toByteArray(); HttpClient httpClient = new DefaultHttpClient(); HttpPost postRequest = new HttpPost("http://myurl.net/uploadphoto.aspx"); ByteArrayBody bab = new ByteArrayBody(data,"5.png"); // File file= new File("/sdcard/mickey.jpg"); // FileBody bin = new FileBody(file,"image/jpg"); MultipartEntity reqEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); // reqEntity.addPart("5.jpg",bin); reqEntity.addPart("5.png", bab); postRequest.setEntity(reqEntity); System.out.println("Method"+postRequest.getMethod()); System.out.println("tostring"+postRequest.toString()); HttpResponse response = httpClient.execute(postRequest); BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent(), "UTF-8")); String sResponse; StringBuilder s = new StringBuilder(); while ((sResponse = reader.readLine()) != null) { s = s.append(sResponse); } System.out.println("Response: " + s); } catch (Exception e) { // handle exception here System.out.println("Error"+e); Log.e(e.getClass().getName(), e.getMessage()); } } </code></pre> <p>In Response Invalid Flie Comes. so plase try to solve my problem. Thanks a lot </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload