0

I have some code to post an image to my php script that uploads to a database, when it adds to the database the file type is application/oct???? (what is this)

is there anyway of changing this to a jpg file at the android stage?

Below is my code

HttpClient client = new DefaultHttpClient();  
             String postURL = "http://10.0.2.2:90/mobileupload3.php";                
             HttpPost post = new HttpPost(postURL); 


         FileBody bin = new FileBody(file);

         MultipartEntity reqEntity = new MultipartEntity();  
         reqEntity.addPart("image", bin);
         reqEntity.addPart("name", new StringBody(enteredName));
         reqEntity.addPart("gender", new StringBody(radio));
         reqEntity.addPart("cat", new StringBody(radio2));
         reqEntity.addPart("lat", new StringBody(lat));
         reqEntity.addPart("lon", new StringBody(lon));

         post.setEntity(reqEntity);  
         HttpResponse response = client.execute(post);  
         HttpEntity resEntity = response.getEntity();  
         if (resEntity != null) {    
                   Log.i("RESPONSE",EntityUtils.toString(resEntity));
             }
    } catch (Exception e) {
        e.printStackTrace();
    }

    }
}
BЈовић
  • 62,405
  • 41
  • 173
  • 273
James
  • 486
  • 1
  • 9
  • 24

1 Answers1

0

application/oct (I assume you mean application/octet-stream) is a MIME type for a general binary file.

Without more information on your method of upload, I believe that the other part of your question has already been answered on SO here.

Community
  • 1
  • 1
Austyn Mahoney
  • 11,398
  • 8
  • 64
  • 85