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 8893171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:10:50+00:00 2026-06-14T23:10:50+00:00

i have data is type String, and i want send this data to server

  • 0

i have data is type String, and i want send this data to server as a xml.How do i do?Can you help me!

httpclient = new DefaultHttpClient();
            httppost = new HttpPost("http://longvansolution.tk/login.php"); // make
                                                                            // sure
                                                                            // the
                                                                            // url
                                                                            // is
                                                                            // correct.
            // add your data
            nameValuePairs = new ArrayList<NameValuePair>(2);
            // Always use the same variable name for posting i.e the android
            // side variable name and php side variable name should be
            // similar,
            nameValuePairs.add(new BasicNameValuePair("username",
                    txtusername.getText().toString().trim())); // $Edittext_value
                                                                // =
                                                                // $_POST['Edittext_value'];
            nameValuePairs.add(new BasicNameValuePair("password",
                    txtpassword.getText().toString().trim()));
            httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
            // Execute HTTP Post Request
            response = httpclient.execute(httppost);

Now i don’t want use this way, i want send xml.

  • 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-06-14T23:10:51+00:00Added an answer on June 14, 2026 at 11:10 pm
    String url = "http://yourserver";
    File file = new File(Environment.getExternalStorageDirectory(),
        "yourfile");
    try {
        HttpClient httpclient = new DefaultHttpClient();
    
        HttpPost httppost = new HttpPost(url);
    
        InputStreamEntity reqEntity = new InputStreamEntity(
            new FileInputStream(file), -1);
        reqEntity.setContentType("binary/octet-stream");
        reqEntity.setChunked(true); // Send in multiple parts if needed
        httppost.setEntity(reqEntity);
        HttpResponse response = httpclient.execute(httppost);
        //Do something with response...
    
    } catch (Exception e) {
        // show error
    }
    

    possible duplicate of ttp://stackoverflow.com/questions/4126625/how-to-send-a-file-in-android-from-mobile-to-server-using-http

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

Sidebar

Related Questions

I have a dictionary variable in C# (ASP.NET). I want to send this data
I want to send image data to the server, For that, I have appended
I have following webservice: [webmethod] public string MakeReservation(?? PassengersInfo)//what data type use for PassengerInfo
I know that SQL Server does not have boolean data type and your best
I have a recursive data type like this: template<typename T> struct SomeType { std::map<T,
Does SQL Server 2008 have a a data-type like MySQL's enum ?
I have the following array: var idParam = [1,2,3]; I want to send this
I have data that I want to send through an ajax GET request in
I have some image data (jpeg) I want to send from my iPhone app
i have Devxpress GridControl on the form, and i want to send data on

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.