Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6604769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:12:02+00:00 2026-05-25T19:12:02+00:00

I am making an android app in which i am sending image to server

  • 0

I am making an android app in which i am sending image to server from /mnt/sdcard/DCIM/Camera/IMG_20110922_124932.jpg to serverthrough multipart request .. Can anybody help me out….
Any help will be appreciated..
Thanks..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T19:12:03+00:00Added an answer on May 25, 2026 at 7:12 pm

    Here is a simple example of a multipart post that I use to send images to a server:

    public void MultipartPost(){
        DefaultHttpClient httpClient = new DefaultHttpClient();
        HttpPost postRequest = new HttpPost(url);
    //Set Credentials
        String auth = User + ":" + Pass;
        byte[] bytes = auth.getBytes();
        postRequest.setHeader("Authorization", "Basic " + new String(Base64.encodeBytes(bytes)));
    
    
        try {
    
    
            MultipartEntity mpC = new MultipartEntity();
    
            //Create stringbody for the filename
        StringBody sbPicID = new StringBody("123.jpg");
    
            //get a file reference from the image on the SD card
        File fle = new File("full path to the file");
    
            //create a filebody from the file
        FileBody fb = new FileBody(fle);
    
        //Add the file name and filebody to the Multipart Entitiy
        mpC.addPart("myImage", sbPicID);
        mpC.addPart("myImage", fb);
    
           //Set the entitiy of the post request to your Multipart
            postRequest.setEntity(mpC);
    
           HttpResponse res;
    
       //execute the post request
           Log.d(TAG,"Starting Send...");
       res = httpClient.execute(postRequest);
       Log.d(TAG, res.getStatusLine().getReasonPhrase());
       Log.d(TAG, res.getStatusLine().getStatusCode());
       res.getEntity().getContent().close();
       Log.d(TAG,"After Close");
    
       } catch (ClientProtocolException e) {
            e.printStackTrace();
       } catch (IOException e) {
            e.printStackTrace();
       } catch (Exception e){
            e.printStackTrace();
       }
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making an android database app in which when i fetch values from
I'm making an Android app where the user can download files from a FTP-server.
hey every body, i am making an android app which interacts with camera. i
I'm making an Android app, which gets its information from XML files. I'm filling
i am making a app which takes photo on button click i have camera.java
I am making an android app in which I need to make different tables
I am making an android app in which i want to make a dynamic
I am creating an android app which pulls in RSS Feeds from here http://spaceflight1.nasa.gov/realdata/sightings/cities/rss/index.cgi?country=United_Kingdom&region=England&city=Manchester
I am mking an android app in which i am making dynamically table rows
We are in the making of an Android app, a quiz game, which we

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.