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

  • Home
  • SEARCH
  • 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 6354131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:31:41+00:00 2026-05-24T22:31:41+00:00

I need to upload file from Android client to an URL via HTTP POST.

  • 0

I need to upload file from Android client to an URL via HTTP POST.
If upload just 1 file, than it is OK for me. but my target URL page code is looks like following

<form action="file_upload.php" enctype ="multipart/form-data" method="post">
<input type="file" name="uploadedfile">
<input type="file" name="uploadedfile2">
<input type="submit">
</form>

How can I upload 2 more files via HTTP POST at same time ?

  • 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-24T22:31:41+00:00Added an answer on May 24, 2026 at 10:31 pm

    I tried following code and confirm that’s workable solution:

    StringBuffer responseBody=new StringBuffer();
    
    Log.i(Constants.TAG, "Ready to upload file...");
    HttpClient client=new DefaultHttpClient();
    client.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1);
    
    Log.i(Constants.TAG, "Set remote URL...");
    HttpPost post=new HttpPost("http://IP.IP.IP.IP/file_upload.php");
    MultipartEntity entity=new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
    
    Log.i(Constants.TAG, "Adding file(s)...");
    entity.addPart("uploadedfile", new FileBody((FileObj), "application/zip"));
    entity.addPart("uploadedfile2", new FileBody((FileObj), "application/zip"));
    
    Log.i(Constants.TAG, "Set entity...");
    post.setEntity(entity);
    
    BufferedReader bs=null;
    try
    {
      Log.i(Constants.TAG, "Upload...");
      HttpEntity hEntity=client.execute(post).getEntity();
      bs=new BufferedReader(new InputStreamReader(hEntity.getContent()));
      Log.i(Constants.TAG, "Response length - "+hEntity.getContentLength());
      String s="";
      while(s!=null)
      {
        responseBody.append(s);
        s=bs.readLine();
        Log.i(Constants.TAG, "Response body - "+s);
      }
      bs.close();
    }
    catch(IOException ioe)
    {
      Log.i(Constants.TAG, "Error on getting response from Server, "+ioe.toString());
      ioe.printStackTrace();
      responseBody.append("...");
    }
    

    My platform is Android 2.2, and use this solution need to get httpmime.jar as project library.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to upload a file from the client to an asp.net page. The
I need simple search-replace in doc file exported from google doc. and than upload
I have a scenario where I need to upload a file from one web
I need a little help here: I get a file from an HTML upload
UPDATED See post #3 below. There is a need to upload a file to
I need to make a POST request via cURL from the command line. Data
after processing a upload file received from an external website, we need to send
hi friends iam trying to upload a file from the android device to the
I need to upload a file in GWT in the background, ie. not from
I need to code for uploading a file from client to server. In client

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.