Question

I want to try developing an android application that can send image/pdfFile from android to android device. For example i have a list of patients. when i click an item it will go to send file to patient that i have clicked. Then the sent file will be stored in database. and will serve as sent file history. Just like an instant messaging. I found an example of instant messaging but this only sending texts not images/files

here AndroidIM

Could anyone convert it to sending images?I really don't know how. Or just link me to some tutorial in sending images/files to another device. I am using also database for storing history of sent files.

Was it helpful?

Solution

send the image to you PHP backend using the Http MultiPart Request like the following :

try{
 HttpClient client = new DefaultHttpClient();
    HttpPost request = new HttpPost(url);

    MultipartEntity entity = new MultipartEntity(
            HttpMultipartMode.BROWSER_COMPATIBLE);

    File file = new File(imagePath);
    ContentBody encFile = new FileBody(file,"image/png");

    entity.addPart("images", encFile);
    request.setEntity(entity);

}catch(Exception e ){

}

and please give me some feedback .

Hope That Helps .

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top