Category : Android | Author : Chtiwi Malek | First posted : 5/30/2012 | Updated : 12/6/2012
Tags : android, upload, file, http, post, data, server, php, .net, aspx, c#, phone, device
Upload Files from Android to a Website/Http Server using Post

Upload Files from Android to a Website/Http Server using Post

In this tutorial I will write an Android class that can be used to upload a File (image, mp3, mp4, text file...) from an android device to a Http web server along with a title and a description using the POST method, I will also write the server side code to read the data sent by our android class.

First we need to have the permission to access internet, so we have to add this line to the AndroidManifest.xml (just after the application section)

<uses-permission android:name="android.permission.INTERNET" />

I will call our class (HttpFileUpload), so just create the file HttpFileUpload.java and copy the code below and set your package name (the 1st line):
package my.package.name;

import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import android.util.Log;
	
public class HttpFileUpload implements Runnable{
        URL connectURL;
        String responseString;
        String Title;
        String Description;
        byte[ ] dataToServer;
        FileInputStream fileInputStream = null;

        HttpFileUpload(String urlString, String vTitle, String vDesc){
                try{
                        connectURL = new URL(urlString);
                        Title= vTitle;
                        Description = vDesc;
                }catch(Exception ex){
                    Log.i("HttpFileUpload","URL Malformatted");
                }
        }
	
        void Send_Now(FileInputStream fStream){
                fileInputStream = fStream;
                Sending();
        }
	
        void Sending(){
                String iFileName = "ovicam_temp_vid.mp4";
                String lineEnd = "\r\n";
                String twoHyphens = "--";
                String boundary = "*****";
                String Tag="fSnd";
                try
                {
                        Log.e(Tag,"Starting Http File Sending to URL");
	
                        // Open a HTTP connection to the URL
                        HttpURLConnection conn = (HttpURLConnection)connectURL.openConnection();
	
                        // Allow Inputs
                        conn.setDoInput(true);
	
                        // Allow Outputs
                        conn.setDoOutput(true);
	
                        // Don't use a cached copy.
                        conn.setUseCaches(false);
	
                        // Use a post method.
                        conn.setRequestMethod("POST");
	
                        conn.setRequestProperty("Connection", "Keep-Alive");
	
                        conn.setRequestProperty("Content-Type", "multipart/form-data;boundary="+boundary);
	
                        DataOutputStream dos = new DataOutputStream(conn.getOutputStream());
	
                        dos.writeBytes(twoHyphens + boundary + lineEnd);
                        dos.writeBytes("Content-Disposition: form-data; name=\"title\""+ lineEnd);
                        dos.writeBytes(lineEnd);
                        dos.writeBytes(Title);
                        dos.writeBytes(lineEnd);
                        dos.writeBytes(twoHyphens + boundary + lineEnd);
	                        
                        dos.writeBytes("Content-Disposition: form-data; name=\"description\""+ lineEnd);
                        dos.writeBytes(lineEnd);
                        dos.writeBytes(Description);
                        dos.writeBytes(lineEnd);
                        dos.writeBytes(twoHyphens + boundary + lineEnd);
	                        
                        dos.writeBytes("Content-Disposition: form-data; name=\"uploadedfile\";filename=\"" + iFileName +"\"" + lineEnd);
                        dos.writeBytes(lineEnd);
	
                        Log.e(Tag,"Headers are written");
	
                        // create a buffer of maximum size
                        int bytesAvailable = fileInputStream.available();
	                        
                        int maxBufferSize = 1024;
                        int bufferSize = Math.min(bytesAvailable, maxBufferSize);
                        byte[ ] buffer = new byte[bufferSize];
	
                        // read file and write it into form...
                        int bytesRead = fileInputStream.read(buffer, 0, bufferSize);
	
                        while (bytesRead > 0)
                        {
                                dos.write(buffer, 0, bufferSize);
                                bytesAvailable = fileInputStream.available();
                                bufferSize = Math.min(bytesAvailable,maxBufferSize);
                                bytesRead = fileInputStream.read(buffer, 0,bufferSize);
                        }
                        dos.writeBytes(lineEnd);
                        dos.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd);
	
                        // close streams
                        fileInputStream.close();
	                        
                        dos.flush();
	                        
                        Log.e(Tag,"File Sent, Response: "+String.valueOf(conn.getResponseCode()));
	                         
                        InputStream is = conn.getInputStream();
	                        
                        // retrieve the response from server
                        int ch;
	
                        StringBuffer b =new StringBuffer();
                        while( ( ch = is.read() ) != -1 ){ b.append( (char)ch ); }
                        String s=b.toString();
                        Log.i("Response",s);
                        dos.close();
                }
                catch (MalformedURLException ex)
                {
                        Log.e(Tag, "URL error: " + ex.getMessage(), ex);
                }
	
                catch (IOException ioe)
                {
                        Log.e(Tag, "IO error: " + ioe.getMessage(), ioe);
                }
        }
	
        @Override
        public void run() {
                // TODO Auto-generated method stub
        }
}
Here’s the function to call the HttpFileUpload and Start sending the file and the data :
public void UploadFile(){
try {
    // Set your file path here
    FileInputStream fstrm = new FileInputStream(Environment.getExternalStorageDirectory().toString()+"/DCIM/file.mp4");

    // Set your server page url (and the file title/description)
    HttpFileUpload hfu = new HttpFileUpload("http://www.myurl.com/fileup.aspx", "my file title","my file description");

    hfu.Send_Now(fstrm);

  } catch (FileNotFoundException e) {
    // Error: File not found
  }
}
 And here’s the server side code to read the File and the data (title and description). In this example the language used is c# .net, but the web server can be any language: php, asp, vb aspx, java…
protected void Page_Init(object sender, EventArgs e)
{
  string vTitle = "";
  string vDesc = "";
  string FilePath = Server.MapPath("/files/cur_file.mp4");        

  if (!string.IsNullOrEmpty(Request.Form["title"]))
  {
    vTitle = Request.Form["title"];
  }
  if (!string.IsNullOrEmpty(Request.Form["description"]))
  {
    vDesc = Request.Form["description"];
  }
	
  HttpFileCollection MyFileCollection = Request.Files;
  if (MyFileCollection.Count > 0)
  {
    // Save the File
    MyFileCollection[0].SaveAs(FilePath);
  }
}
Have fun and don't hesitate to ask me any questions or send me your thoughts.
About the author :
Malek Chtiwi is the man behind Codicode.com
34 years old full stack developer.
Loves technology; but also likes design, photography and composing music.
Comments & Opinions :
the code of server side
Hi Chtiwi Malek

Thanks for your article
Could you suggest me how to write the server side code by jsp ?
- by Jordanhsu on 6/28/2012
error
hi,
help me pls i have server on iis 6
and have this error
"method does not support a request body: POST" in
this part DataOutputStream dos = new DataOutputStream(conn.getOutputStream());


can you help me ?
- by Reynor 77 on 9/9/2012
An Image Upload in php server
Hello Dear,
I want to upload an image to server side.Using create file.Please help me how i send that image file to server side.
Please reply soon It's emergency......
- by Ayaz on 10/3/2012
vxcv xcv cxzcxv zcv zcxv zc
- by xvcbxcv on 12/11/2014
How i get image back from asp.net code

hi,

i`ve uploaded image from my android program to asp.net site.but now i want to get back same image from asp.net in my android application. how can i do this ....how i send image to my program...using asp.net Response Object......

- by Zohaib on 11/19/2012
Getting image back from asp.net is not really hard.You can just get the json data back which contains the URL and image name information ,then you can download it directly by the url you get.
- by Allen on 11/25/2013
Hi,

Dear Zohaib,

I also need to upload image. Please send me the sample code that you have done, to upload image.

Waiting for your reply.

Your truly,

Thanks and regards

Hasnain Ahmad
hasnain_ahmad@outlook.com


 
- by Hasnain Ahmad on 2/15/2015
Where exactly the server side code should be written?
HI,,

Am new to android. i have gone through ur code. this is what i want.. but am not sure where to write server part(c++) code. plz help me.

Thanks in advance.
- by Divya on 11/26/2012
Thank You
You help me, Thank
- by Bhumi Ph on 12/25/2012
how to locate the uploaded file?
thnx for the tutorial. I have executed the code but nothing happened it neither give me the error nor any response from the server. could you please explain a little about how to properly write the server side code and where to locate the file on webserver?
- by Nouman on 1/7/2013
protected void Page_Init(object sender, EventArgs e) { string filename = ""; if (!string.IsNullOrEmpty(Request.Form["filename"])) { filename = Request.Form["filename"]; } string FilePath = "D:/FilesFromDevice/" + filename; HttpFileCollection MyFileCollection = Request.Files; if (MyFileCollection.Count > 0) { MyFileCollection[0].SaveAs(FilePath); } } Open Visual studio, create new website with c# code back. Copy the server code from above, past it in cs file. u can change virtual dir to physical dir. Run it works charm.
- by Udh on 3/14/2014
Thanks a lot!
About two days i'am trying to upload image to server (vkontakte), but all attemps was failed.
After using your code all is ok.
I do not know what the difference and where my mistake (but i'll find it).
anyway - thanks again.
- by Eugene on 1/17/2013
Hi Eugene! I also killed 2 days to post image on vkontakte wall, but still not succeeded. I always get {"server":323527,"photo":"[]","hash":"ece54ef43d9b5928c8ff9ad9ab56ef0c"} as a result of POST http request. This code did'nt help either. Could you please share you piece of code that makes posting. Thanks!
- by Nik on 5/30/2013
server side code in PHP
Hello i want to write server side code in php insted off c# can you help me ?
- by Miral on 1/23/2013
Codigo Java
Please help me with a source file to analyze the code is useful to complete a project, and can I have the server side code in JAVA
- by Foster on 2/3/2013
Update for async thread task
I am getting a NetworkOnMainThreadException that is caused because you are trying to call a network task on the main thread. It is advised to make an async task to run your network request. I liked your guide, just hope you update it.
- by francisco on 2/10/2013
great stuff, but there must be an easier way these days....
there must be a simpler method these days.

in html5 it looks a lot easier, as you can use the FormData object
(example from: https://hacks.mozilla.org/2010/05/formdata-interface-coming-to-firefox/ )
// aFile could be from an input type="file" or from a Dragged'n Dropped file
var formdata = new FormData();
formdata.append("nickname", "Foooobar"); 
formdata.append("website", "http://hacks.mozilla.org");
formdata.append("media", aFile);
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://foo.bar/upload.php");  
xhr.send(formdata);

but how would you do this in Android? perhaps using a combination of a webview (html + javascript) and android javacode for selecting the image, or receiving the image from a send image (share image) intent.
- by holo deck supervisor on 2/16/2013
Out of memory on a xxxxxx (bytes) allocation
I used your posted code. When i upload file (20MB), it throws exception. Please help me! thanks in advance.
- by duong on 2/20/2013
Networkstrictmode
Hi,
I get "02-20 16:25:52.338: E/AndroidRuntime(24527): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dowrgv.picturesapp/com.dowrgv.picturesapp.GalleryActivity}: android.os.NetworkOnMainThreadException " with approximately no modified code except using a separate class...

- by rgvneil on 2/20/2013
do not know some details...
Hi,

1."the function to call the HttpFileUpload and Start sending the file and the data" called public void UploadFile() should put where in android to call,
2."my file title" means file name ?,
3. "my file description" is what?
4. in HttpFileUpload class whose "green charactors" i need to change for my case , like my file name etc.
	
conn.setRequestProperty("Connection", "Keep-Alive");

conn.setRequestProperty("Content-Type", "multipart/form-data;boundary="+boundary);

DataOutputStream dos = new DataOutputStream(conn.getOutputStream());

dos.writeBytes(twoHyphens + boundary + lineEnd);
dos.writeBytes("Content-Disposition: form-data; name=\"title\""+ lineEnd);
dos.writeBytes(lineEnd);
dos.writeBytes(Title);
dos.writeBytes(lineEnd);
dos.writeBytes(twoHyphens + boundary + lineEnd);

dos.writeBytes("Content-Disposition: form-data; name=\"description\""+ lineEnd);
dos.writeBytes(lineEnd);
dos.writeBytes(Description);
dos.writeBytes(lineEnd);
dos.writeBytes(twoHyphens + boundary + lineEnd);

dos.writeBytes("Content-Disposition: form-data; name=\"uploadedfile\";filename=\"" + iFileName +"\"" + lineEnd);
i know ask too many questions to be rude,but i really need ur help
- by Aqua on 5/23/2013
PLease tell me the server side code in php
Please tell me the server side code in php
- by Sshlok on 5/29/2013
Perfect!
tried lots of other scripts to do this without success but this one worked first time. nice coding!
- by Amos on 6/6/2013
can u send me that example u worked... I'm trying this code for past one day i didnt get result..... Pls send me to this mail id unathantsb@gmail.com
- by Nathan on 7/6/2013
plz send me the code for this .. i reAlly need help. on my email id omaimatauqeer@gmail.com
- by omaima on 4/27/2016
Video not uploading
Hi......
I'am nathan, ii tried the above code no error in android code and dotnet. Video is not uploading got response code as 200.
pls clear my doubt
- by Nathan on 7/8/2013
I have the same problem... nothing saved to server
- by Maha on 8/25/2014
Req Project
how i can get complete source code ?
- by Bambang Shines on 9/6/2013
Fetching the filename list from HTTP server in android
Hi..
I'm vignesh, i m trying to fetch filename list from http server. I could able to fetch the single file by url with file name,but could not  able to fetch the filename list  from http server directory from android.
can you give some idea to get the filename list from http server?

-vigneshs
- by vignesh on 11/27/2013
Help me please
Hi I get a url from a server and then I only want to upload an image should I use all the code you written I don't want to store a file with "--" or other things like that (I get a url and want to upload a file only)
- by Mohammed Alhammouri on 8/11/2014
Done.. but nothing saved to server
I need the server side code for the asp.net page ""http://www.myurl.com/fileup.aspx"".. i have run your code with out any server side code.. it is done but nothing uploaded to server
- by Maha on 8/25/2014
can anybody send me full source code
tried lots of other scripts and this code ,its not working

can anybody  send me that example u worked... I'm trying this code for past three days i didnt get result..... Pls send me to this mail id ssanthosh0443@gmail.com
- by santhosh on 8/26/2014
Php implimentation
The code works great. Maybe you need to check the permissions of the temp, and uploads directories on your server. However, if using php as the server side language, the following is the code responsible for transfering your file to the uploads directory. You must have either the 'temp' or 'tmp' folder on your server and they should be publicly accessible. that's how i made mine work

<?php
//takes care of remote file uploads

//start upload
$file_path = "uploads/";
     
    $file_path = $file_path . basename( $_FILES['uploaded_file']['name']);
    if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $file_path)) {
        echo "success";
    } else{
        echo "fail";
    }

?>
- by larrytech on 10/13/2014
can you send the source code of all this work plz....... at omaimatauqeer@gmail.com
- by omaima on 4/27/2016
Add parameters
Sir how to add parameters along with the image in above code.
- by Amir on 10/27/2014
Add parameters
Sir how to add parameters along with the image in above code.
- by Amir on 10/27/2014
Exact Solution for imageupload to mvc5
 public async Task<HttpResponseMessage> PostFile()
        {
            // Check if the request contains multipart/form-data.
            if (!Request.Content.IsMimeMultipartContent())
            {
                throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType);
            }

            string root = HttpContext.Current.Server.MapPath("~/File");
            var provider = new MultipartFormDataStreamProvider(root);

            try
            {
                StringBuilder sb = new StringBuilder(); // Holds the response body

                // Read the form data and return an async task.
                await Request.Content.ReadAsMultipartAsync(provider);

                // This illustrates how to get the form data.
                foreach (var key in provider.FormData.AllKeys)
                {
                    foreach (var val in provider.FormData.GetValues(key))
                    {
                        sb.Append(string.Format("{0}: {1}\n", key, val));
                    }
                }

                // This illustrates how to get the file names for uploaded files.
                foreach (var file in provider.FileData)
                {
                    FileInfo fileInfo = new FileInfo(file.LocalFileName);
                    sb.Append(string.Format("Uploaded file: {0} ({1} bytes)\n", "abc.jpg", fileInfo.Length));
                }
                return new HttpResponseMessage()
                {
                    Content = new StringContent(sb.ToString())
                };
            }
            catch (System.Exception e)
            {
                return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e);
            }
        }
- by Vikas gawali on 1/5/2015
How could I sent file to other friend?
Hi! I have a chat app, and I want to add the functionality to send files to my buddy, and my buddy also send me files too. How could I do this? Thanks!
- by Chera Robinson on 1/15/2015
conn.getInputStream() returns result along with some TAGS
Hi 
It works like charm to upload files.
Only concern is i'm tryeing read some string response from server to make sure my data posted successfully.
I got the response string but that comes up with <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- by Mohan Raj on 1/22/2015
conn.getInputStream() returns result along with some TAGS
Hi 
It works like charm to upload files.
Only concern is i'm tryeing read some string response from server to make sure my data posted successfully.
I got the response string but that comes up with <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- by Mohan Raj on 1/22/2015
conn.getInputStream() returns result along with some TAGS
Hi 
It works like charm to upload files.
Only concern is i'm tryeing read some string response from server to make sure my data posted successfully.
I got the response string but that comes up with <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- by Mohan Raj on 1/22/2015
Top Periority
Hi,

Dear friends

I am also working on android application that will upload the image from android client to MS SQL Server  using asp.net c# web service.

Can anyone share sample the code for uploading the image

Waiting for your reply.

Please reply me as soon as possible.

Your truly,

Thanks and regards

Hasnain Ahmad

 
- by Hasnain Ahmad on 2/15/2015
Top Periority
Hi,

Dear friends

I am also working on android application that will upload the image from android client to MS SQL Server  using asp.net c# web service.

Can anyone share sample the code for uploading the image

Waiting for your reply.

Please reply me as soon as possible.

Your truly,

Thanks and regards

Hasnain Ahmad

 
- by Hasnain Ahmad on 2/15/2015
It worked for me
I appreciate you. This worked for me, too.
- by Ahmad Ebrahimi on 2/16/2015
It is working for me
Thanks
- by a on 2/26/2015
reply quickly plz...
send me the code to upload image using webservise in c#.
how can I upload image from webservice...
- by zoya on 3/31/2015
uploading image query
i have a an image in my project i select image from phone gallery or capture from smart phone camera and i display that image on interface and now i have an send button what i want to upload that image on website for feature extraction kindly help me as soon as possible i want to upload that image by clicking on send button and image will upload on asp.net. thanks
- by Nouman Tariq on 4/7/2015
uploading image query
i have a an image in my project i select image from phone gallery or capture from smart phone camera and i display that image on interface and now i have an send button what i want to upload that image on website for feature extraction kindly help me as soon as possible i want to upload that image by clicking on send button and image will upload on asp.net. thanks
- by Nouman Tariq on 4/7/2015
uploading binary file using http post
Hello,
I just want to know,that is it possible to send binary file(pdf,doc,text) using http post in android.
 
- by Vivek kumar on 4/16/2015
Uploading zip file to server
I want to upload a zipped file to server. I want send it using wifi, I have to didect first wether the wifi is on of not, I did it. I searched for srcipts to post ziped file to server using wifi in andorid, but I didnt get anythe one that works. 
Please hlep me on this or the code is the same as this one?  
 
- by Jaykin on 4/24/2015
Uploading zip file to server
I want to upload a zipped file to server. I want send it using wifi, I have to didect first wether the wifi is on of not, I did it. I searched for srcipts to post ziped file to server using wifi in andorid, but I didnt get anythe one that works. 
Please hlep me on this or the code is the same as this one?  
 
- by Jaykin on 4/24/2015
Very helpfull
Thank a lot .....
- by Arjun on 5/23/2015
Send and receive files
Hey Dear, i am new in android. i have made an application that communicate between user by text messages using sockets and xampp server. now i want to attach some files like image and send it to other user... please help me.... thanks for any help...
- by Waseem Akram on 6/10/2015
Special characters
Hi,
Several parts in your post make me very confused, I don't understand the meaning of:
String lineEnd = "\r\n";
String twoHyphens = "--";
String boundary = "*****";
and also the way you have used them.
Please explain to me in details.
Thanks !
- by DucIT on 6/18/2015
Image upload
hello, we want a code where the user is allowed to choose an image to upload...not the what you have done by specifying the image name in the code. open gallery, choose your image then upload. please help
- by zeffah on 7/6/2015
Image Upload From Mobile To Web Server
UploadFile() and Asp.net C# Code Don't Understand by me Please give me hint how to use that code
and UploadFile() function code where is wrriten
- by Bhavin on 8/21/2015
Uploading failed from other folder except Gallery
package com.healhouts.healthouts_v1.FragmentsPackage;

/**
 * Created by samsung on 24-06-2015.
 */

import android.app.AlertDialog;
import android.app.Fragment;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.StrictMode;
import android.provider.MediaStore;
import android.provider.Settings;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.Toast;

import com.healhouts.healthouts_v1.R;
import com.healhouts.healthouts_v1.common.AndroidMultiPartEntity;
import com.healhouts.healthouts_v1.common.CommonUtil;
import com.healhouts.healthouts_v1.common.Config;
import com.healhouts.healthouts_v1.common.ConnectionDetector;
import com.squareup.picasso.Picasso;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URISyntaxException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;

import java.util.Date;

public class AboutMe extends Fragment implements AdapterView.OnItemSelectedListener {

    private Spinner spDate, spMonth, spYear;
    private static final String[] date = {"01","02","03","04","05","06","07","08","09",
            "10","11","12","13","14","15","16","17","18","19","20","21","22","23","24",
            "25","26","27","28","29","30","31"};
    private static final String[] month = {"January", "February", "March", "April",
            "May", "June", "July", "August", "September",
            "October", "November", "December"};
    private  String[] year  ;
    String TAG=getClass().getName();
    String item="";
    String bg="";
    String sex="";
    ProgressDialog pDialog;
    AlertDialog.Builder builder;
    JSONObject jsonObj;
    private Context context;
    Boolean isInternetPresent = false;
    ConnectionDetector cd;
    JSONArray jsonArray;
    SharedPreferences userSharedPreferences;
    private String customerId;
    private  String customerEmail;
    private boolean loginStatus = false;
    JSONObject jsonObject;

    public Button saveProfile;
    EditText name,dob,location,zipcode,info;
    String nameET,dobET,locationET,zipcodeEt,infoET;
    ImageView imgpath;
    Button savechanges;
    String attachmentFile="";
    ImageButton imgButtonView;
    private static int RESULT_LOAD_IMAGE = 1;
    String url="http://healthouts.com/appCustomerBasicDetails?";
//    String url2="http://healthouts.com/appUpdateCustomerAboutme?";

    Spinner bloodGroup;
    String[] bloodGroups = new String[]
            {"O+","A+","B+","AB+","O-","A-","B-","AB-"};


    Spinner gender;
    String[] genderGroups = new String[]
            {"Male","Female"};


    @Override
    public void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
        StrictMode.setThreadPolicy(policy);
        context = getActivity().getApplicationContext();
        cd = new ConnectionDetector(context);
        isInternetPresent = cd.isConnectingToInternet();
        userSharedPreferences = this.getActivity().getSharedPreferences(context.getString(R.string.cPreferences), Context.MODE_PRIVATE);
        customerId = userSharedPreferences.getString(context.getString(R.string.customerId), null);
        customerEmail = userSharedPreferences.getString(getActivity().getResources().getString(R.string.customerEmail), null);

        View view = inflater.inflate(R.layout.about_me, null);

        bloodGroup=(Spinner)view.findViewById(R.id.bloodGroup);
        gender=(Spinner)view.findViewById(R.id.gender);
        savechanges = (Button) view.findViewById(R.id.savechanges);
        name = (EditText) view.findViewById(R.id.name);
        dob = (EditText) view.findViewById(R.id.dob);

         for (int x=0,y=1940;y<Calendar.getInstance().get(Calendar.YEAR-1);x++,y++){
             year[x]= String.valueOf(y);
             Log.d(TAG,"year values"+year[x]);
         }
        location = (EditText) view.findViewById(R.id.location);
        zipcode = (EditText) view.findViewById(R.id.cState);
        info = (EditText) view.findViewById(R.id.info);
        saveProfile=(Button)view.findViewById(R.id.savechanges);
        imgButtonView =(ImageButton)view.findViewById(R.id.imagePath);
        imgButtonView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View arg0) {
                Intent i = new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
                startActivityForResult(i, RESULT_LOAD_IMAGE);
            }
        });

        saveProfile.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                saveMyDetails();

            }
        });


        ArrayAdapter<String> adapter2 = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_dropdown_item_1line, genderGroups);
        gender.setAdapter(adapter2);
        gender.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> arg0, View arg1,
                                       int arg2, long arg3) {
                sex = arg0.getItemAtPosition(arg2).toString();
            }

            @Override
            public void onNothingSelected(AdapterView<?> arg0) {
            }
        });



        ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_dropdown_item_1line, bloodGroups);
        bloodGroup.setAdapter(adapter);
        bloodGroup.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> arg0, View arg1,
                                       int arg2, long arg3) {
                bg = arg0.getItemAtPosition(arg2).toString();
            }

            @Override
            public void onNothingSelected(AdapterView<?> arg0) {
            }
        });


        getAboutMe();
        return view;
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == RESULT_LOAD_IMAGE  && null != data) {
            Uri selectedImage = data.getData();
            String[] filePathColumn = { MediaStore.Images.Media.DATA };
            Cursor cursor = context.getContentResolver().query(selectedImage,filePathColumn, null, null, null);
            cursor.moveToFirst();
            int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
            attachmentFile = cursor.getString(columnIndex);
            Log.d("---", "----picturePath--"+attachmentFile);
            Bitmap bmp = BitmapFactory.decodeFile( attachmentFile );
            bmp = Bitmap.createScaledBitmap(bmp, 100,100,false);

            Log.d(TAG,"is recycled"+bmp.isRecycled());
            imgButtonView.setImageBitmap(bmp);
        }
    }



    public void saveMyDetails() {
        new AsyncTask<Void, Integer, String>() {

            @Override
            protected void onPreExecute() {
                super.onPreExecute();
                pDialog = new ProgressDialog(getActivity());
                pDialog.setTitle("Please wait");
                pDialog.setMessage("processing.... ");
                pDialog.setCancelable(false);
                pDialog.show();
                builder = new AlertDialog.Builder(getActivity());
                // setting progress bar to zero

            }

            @Override
            protected String doInBackground(Void... params) {
                return uploadFile();
            }


            private String uploadFile() {

                String responseString = null;

                HttpClient httpclient = new DefaultHttpClient();
                HttpPost httppost = new HttpPost(Config.UPDATE_ABOUTME_URL);
                try {
                    AndroidMultiPartEntity entity = new AndroidMultiPartEntity(
                            new AndroidMultiPartEntity.ProgressListener() {

                                @Override
                                public void transferred(long num) {
//                                    publishProgress((int) ((num / (float) totalSize) * 100));
                                }
                            });

                    entity.addPart("CId ", new StringBody(customerId));

                    entity.addPart("CEmail ", new StringBody(customerEmail));
                    entity.addPart("cName ", new StringBody(name.getText().toString()));
                    entity.addPart("gender", new StringBody(sex));
                    entity.addPart("dob", new StringBody(dob.getText().toString()));
                    entity.addPart("city", new StringBody(location.getText().toString()));
                    entity.addPart("zipcode", new StringBody(zipcode.getText().toString()));
                    if(!attachmentFile.equals("")) {
                        File sourceFile = new File(attachmentFile);
                        entity.addPart("profilepImage", new FileBody(sourceFile));
                    }
                    entity.addPart("info", new StringBody(info.getText().toString()));
                    entity.addPart("bloodGroup", new StringBody(bg));

                    httppost.setEntity(entity);
                    // Making server call
                    HttpResponse response = httpclient.execute(httppost);
                    HttpEntity r_entity = response.getEntity();

                    int statusCode = response.getStatusLine().getStatusCode();
                    if (statusCode == 200) {
                        // Server response
                        responseString = EntityUtils.toString(r_entity);
                    } else {
                        responseString = "Error occurred! Http Status Code: "
                                + statusCode;

                    }
                } catch (UnsupportedEncodingException e) {
                    e.printStackTrace();
                } catch (ClientProtocolException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                }

                return responseString;
            }

            @Override
            protected void onPostExecute(String resultString) {
                super.onPostExecute(resultString);
                if (pDialog.isShowing())
                    pDialog.dismiss();
//                Toast toast = Toast.makeText(context, resultString, Toast.LENGTH_LONG);
//                toast.getView().setBackgroundColor(getResources().getColor(R.color.error_toast));
//                toast.show();
                if (resultString != null && !resultString.equals("")) {
                    try {
                        JSONObject jsonObject = new JSONObject(resultString);
                        if (jsonObject.getString("status").equals("1")) {
                            builder.setCancelable(true);
                            builder.setMessage(jsonObject.getString("message"));
                            builder.setInverseBackgroundForced(true);
                            builder.setPositiveButton("Done", new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    dialog.dismiss();
                                }
                            });
                            builder.show();

                        } else {
                            Toast toast = Toast.makeText(context, jsonObject.getString("message"), Toast.LENGTH_LONG);
                            toast.getView().setBackgroundColor(getResources().getColor(R.color.error_toast));
                            toast.show();
                        }
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }

                } else {
                    Toast toast = Toast.makeText(context, "Sorry! Due to some problem Message sending failed", Toast.LENGTH_LONG);
                    toast.getView().setBackgroundColor(getResources().getColor(R.color.error_toast));
                    toast.show();
                }
            }

        }.execute();

    }




    private void getAboutMe() {
        String jsonStr = "";
        ServiceHandler sh = new ServiceHandler();

        String str = "";
        str = str + url;

        try {

            String queryStr = new CommonUtil().ConvertToUrlString(str + "CId=" + customerId + "&CEmail=" + customerEmail);
            Log.d(TAG, "Query string  is" + queryStr);

            if (isInternetPresent) {

                jsonStr = sh.makeServiceCall(queryStr, ServiceHandler.GET);
                try {

                    jsonObject = new JSONObject(jsonStr);

                    Log.d(TAG,"path is"+"http://healthouts.com/img/"+jsonObject.optString("imagePath"));

                    if (!jsonObject.optString("imagePath").equals("")) {

//                        Picasso.with(context).shutdown();
//                        Picasso.with(context).invalidate(new CommonUtil().ConvertToUrlString("http://healthouts.com/img/" + jsonObject.optString("imagePath")));
                        Picasso.with(context).load(new CommonUtil().ConvertToUrlString("http://healthouts.com/img/" + jsonObject.optString("imagePath")))
                                .error(R.drawable.person_image_empty)
                                .placeholder(R.drawable.healthouts)
                                .into(imgButtonView);


//                        ImageHandler.getSharedInstance(context).load(new CommonUtil().ConvertToUrlString("http://healthouts.com/img/" + jsonObject.optString("imagePath"))).error(R.drawable.person_image_empty)
//                                .placeholder(R.drawable.person_image_empty)
//                                .into(imgButtonView);
//                        LruCache lru = new LruCache(24000);
//                        lru.clear();
//                        Picasso p = new Picasso.Builder(context)
//                                .memoryCache(lru)
//                                .build();
//                        p.load(new CommonUtil().ConvertToUrlString("http://healthouts.com/img/" + jsonObject.optString("imagePath"))).memoryPolicy(com.squareup.picasso.MemoryPolicy.NO_CACHE)
//                                .error(R.drawable.person_image_empty)
//                                .placeholder(R.drawable.healthouts)
//                                .into(imgButtonView);
                    }

                    jsonObject.optString("name");
                    jsonObject.optString("dob");
                    jsonObject.optString("location");
                    jsonObject.optString("zipcode");
                    jsonObject.optString("info");
                    jsonObject.optString("gender");
                    jsonObject.optString("bloodGroup");
                    Log.d(TAG,"bg"+jsonObject.optString("bloodGroup"));


                    name.setText(jsonObject.optString("name"));
                    dob.setText(jsonObject.optString("dob"));
                    location.setText(jsonObject.optString("location"));
                    zipcode.setText(jsonObject.optString("zipcode"));
                    info.setText(jsonObject.optString("info"));
                    for(int i=0; i<=bloodGroups.length;i++) {
                        if(bloodGroups[i].equals(jsonObject.optString("bloodGroup")))
                            bloodGroup.setSelection(i);
                    }

                    for(int i=0; i<=1;i++) {
                        if(genderGroups[i].equals(jsonObject.optString("gender")))
                            gender.setSelection(i);
                    }
                } catch (Throwable t) {
                }

            } else {
                getActivity().runOnUiThread(new Runnable() {
                    public void run() {
                        final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
                        builder.setTitle("Connection failure");
                        builder.setMessage("Please check your network connection and try again");
                        builder.setIcon(R.drawable.warn)
                                .setPositiveButton("cancel", new DialogInterface.OnClickListener() {
                                    public void onClick(DialogInterface dialog, int id) {
                                        builder.setCancelable(true);
                                    }
                                })
                                .setNegativeButton("Wi-Fi Settings", new DialogInterface.OnClickListener() {
                                    public void onClick(DialogInterface dialog, int id) {
                                        startActivityForResult(new Intent(Settings.ACTION_WIFI_SETTINGS), 0);

                                    }
                                });
                        builder.show();

                    }
                });

            }

        } catch (URISyntaxException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }


    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onActivityCreated(savedInstanceState);
    }

    @Override
    public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {

    }

    @Override
    public void onNothingSelected(AdapterView<?> parent) {

    }
/*

    private class GetData extends AsyncTask<String,String,String> {
        @Override
        protected String doInBackground(String... params) {
            String jsonStr1 = "";
            ServiceHandler sh = new ServiceHandler();

            *//**query parameters : 1. CId (cusotmer Id)
     2. CEmail (customer email)
     3. cName (cusotmer name)
     4. gender
     5. dob (customer date of birth)
     6. city
     7. zipcode
     8. profilepImage
     9. info (about customer information
     10. bloodGroup
     *//*          nameET=name.getText().toString();
            dobET=dob.getText().toString();
            locationET=location.getText().toString();
            zipcodeEt=zipcode.getText().toString();
            infoET=info.getText().toString();
            String bgroup=bg;
            String gend=sex;
            String imagepath="http://healthouts.com/img/TriNadh193.jpg";




            String str = "";
            str = str + url2;


                String queryStr1 = new CommonUtil().ConvertToUrlString(str +"CId="+customerId+"&CEmail="+customerEmail+"&cName="+nameET+"&gender="+gend+"&dob="+dobET+"&city="+locationET+"&bloodGroup="+bgroup+"&zipcode="+zipcodeEt+"&profilepImage="+imagepath+"&info="+infoET);
            queryStr1 = queryStr1.replace("+","%2b");
            Log.d("---", "Query string  is" + queryStr1);

                if (isInternetPresent) {

                    try {
                        jsonStr1 = sh.makeServiceCall(queryStr1, ServiceHandler.POST);
                    } catch (URISyntaxException e) {
                        e.printStackTrace();
                    }

                    String flag="1";
                    Log.d(TAG,"jsonobject after"+jsonObj);
                    try {
                        jsonObj = new JSONObject(jsonStr1);
                        if (jsonObj.getString("status").equals(flag)) {
                            getActivity().runOnUiThread(new Runnable() {
                                public void run() {
                                    builder = new AlertDialog.Builder(getActivity());
                                    builder.setCancelable(true);
                                    try {
                                        builder.setMessage(jsonObj.getString("message"));
                                    } catch (JSONException e) {
                                        e.printStackTrace();
                                    }
                                    builder.setInverseBackgroundForced(true);
                                    builder.setNeutralButton("Ok", new DialogInterface.OnClickListener() {
                                        public void onClick(DialogInterface dialog, int whichButton) {
                                            dialog.dismiss();
                                        }
                                    });

                                    builder.show();
                                }
                            });
                        }
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                    System.out.print(jsonObj);



                    try {

                        JSONObject jsonObject=new JSONObject(jsonStr1);
                        Log.d(TAG,"saved datais"+jsonObject);
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }


                } else {
                    getActivity().runOnUiThread(new Runnable() {
                        public void run() {

                            final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
                            builder.setTitle("Connection failure");
                            builder.setMessage("Please check your network connection and try again");
                            builder.setIcon(R.drawable.warn)
                                    .setPositiveButton("cancel", new DialogInterface.OnClickListener() {
                                        public void onClick(DialogInterface dialog, int id) {
                                            builder.setCancelable(true);
                                        }
                                    })
                                    .setNegativeButton("Wi-Fi Settings", new DialogInterface.OnClickListener() {
                                        public void onClick(DialogInterface dialog, int id) {
                                            startActivityForResult(new Intent(Settings.ACTION_WIFI_SETTINGS), 0);


                                        }
                                    });
                            builder.show();

                        }
                    });

                }



            return null;
        }
    }*/
}

Unfortunately App has been stopped,when i am picking image other than "Gallery".unable to access image from  other folder  except Gallery.Could you please help me out 
- by TRinadh on 8/29/2015
code
nhi pta
- by pradeep on 10/5/2015
send .txt by internal storage
I am trying to send a .txt file from the internal memory, follow all the steps, I use C # as well, and the feedback we get from app is ok all right at first, the server also followed the steps, put only to generate error files or success, can not receive this file, even getting the return ok, would have some setting or something on the server side?
- by Fabilei on 10/18/2015
send .txt by internal storage
I am trying to send a .txt file from the internal memory, follow all the steps, I use C # as well, and the feedback we get from app is ok all right at first, the server also followed the steps, put only to generate error files or success, can not receive this file, even getting the return ok, would have some setting or something on the server side?
- by Fabilei on 10/18/2015
send .txt by internal storage
I am trying to send a .txt file from the internal memory, follow all the steps, I use C # as well, and the feedback we get from app is ok all right at first, the server also followed the steps, put only to generate error files or success, can not receive this file, even getting the return ok, would have some setting or something on the server side?
- by Fabilei on 10/18/2015
Parameters and an image file
Hi!
Thanks for the time you took to make this, i've been trying to implement this solution but it was not possible for me, i keep getting some errors i don't really understand, all i need is to upload an image with 2 string parameters alongside, if i try to do it with Postman, is just posting 2 text keys with 1 file key. So i am not sure where should i name the parametters. i get an IO error with java.io.FileNotFoundException:, not sure what that means.
- by Andrés Felipe on 10/20/2015
Parameters and an image file
Hi!
Thanks for the time you took to make this, i've been trying to implement this solution but it was not possible for me, i keep getting some errors i don't really understand, all i need is to upload an image with 2 string parameters alongside, if i try to do it with Postman, is just posting 2 text keys with 1 file key. So i am not sure where should i name the parametters. i get an IO error with java.io.FileNotFoundException:, not sure what that means.
- by Andrés Felipe on 10/20/2015
Request.form is empty after posting file
Hello hopfuly you can help me
Actually I found for now only your example with ASPX
My problem is that Im posting from android APP file directly to the web site - no error everything seems to be normal
But 
Request.Form 
is empty
When I use imput tag with runat server then I see the file.
Im using simple APP from APP inventor2 with WEB component
I successfully posted file but my web site didnt see it. Do you have idea why?
I would be grateful for any help you can provide I realy dont understand why on PHP platfom its working and on the ASPX not.
I have also prepared the application in the C# but I fased the same problem
ASPX scrip didnt see the POSTED file.
- by Radek Prachfeld on 11/12/2015
Nice tutorial
Nice tutorial but the code use has been depricated. Instead try this article http://blog.hackerkernel.com/2015/11/30/android-upload-image-to-server/
- by ali amir on 12/1/2015
Getting error 200
Hello,
Thanks very much for the code.
I am trying to send a file/picture that is within a particular folder within my phone, to a server.
On the server side I have written some PHP and I know that the directory where I want the picture to be copied to has the correct permissions. I am able to send a picture from an iOS device.

I get a server code of 200 using your code, and the tells me the picture did not save...
Would you know why this is? 
Thanks very much
- by Ana on 12/11/2015
miquelzapata@web.de
I've been reviewin online more than eight hours today for https://cheapcalgarypainting.wordpress.com/2015/11/28/interior-painting-calgary-houses-to-perfection-for-half-price/ & Upload Files from Android to a Website/Http Server using Post, yet I never found any interesting article like yours. It's pretty worth enough for me. In my view, if all site owners and bloggers made good content as you did, the net will be much more useful than ever before.
- by ZS on 2/4/2016
marvinandronicus@web.de
I have been reviewin online more than four hours today for https://cheapcalgarypainting.wordpress.com/2015/09/09/calgary-house-painters-will-save-you-half-price-on-house-painting/ & Upload Files from Android to a Website/Http Server using Post, yet I never found any interesting article like yours. It's pretty worth enough for me. Personally, if all webmasters and bloggers made good content as you did, the net will be a lot more useful than ever before.
- by KP on 2/6/2016
uta.perkinson@inbox.com
I been reviewing online more than 2 hours today for https://cheapcalgarypainting.wordpress.com/ & Upload Files from Android to a Website/Http Server using Post, yet I never found any interesting article like yours. It's pretty worth enough for me. Personally, if all site owners and bloggers made good content as you did, the internet will be much more useful than ever before.
- by UU on 2/7/2016
How to upload word,pdf files to server from andoid
sir,
I am trying whole day to upload text file such as pdf,word files to my local host.But i could not do it.If you have any code which perform same peration please send it to me.
Thank you
- by shyam on 2/14/2016
olivesteinke@gmail.com
I have been surfing online more than two hours today for http://cheapcalgarypainters.bravesites.com & Upload Files from Android to a Website/Http Server using Post, yet I never found any interesting article like yours. It's pretty worth enough for me. In my opinion, if all webmasters and bloggers made good content as you did, the net will be much more useful than ever before.
- by ST on 2/19/2016
NEED PHP CODE INSTEAD OF C# !!!!
can u give the php code instead of the c# code...pleeeassee
- by tuhin on 3/10/2016
NEED PHP CODE INSTEAD OF C# !!!!
can u give the php code instead of the c# code...pleeeassee
- by tuhin on 3/10/2016
ingridhomer@googlemail.com
ขึ้นมันแข็งก็ชมคว้าใสเตือน http://www.mp3player.in.th/%E0%B8%AA%E0%B8%B2%E0%B8%A2-aux-%E0%B9%83%E0%B8%99%E0%B8%A3%E0%B8%96-%E0%B8%AA%E0%B8%B2%E0%B8%A2-aux-iphone/ ดำรงฐานะทางออกในงานเล่าต่อนัดต่อแนงไม่จัดหามาดำรงฐานะจากจัดหามา http://www.mp3player.in.th/%E0%B8%AA%E0%B8%B2%E0%B8%A2-aux-%E0%B9%83%E0%B8%99%E0%B8%A3%E0%B8%96-%E0%B8%AA%E0%B8%B2%E0%B8%A2-aux-iphone/ นงคราญเสนอที่งานถวายสัมภาษณ์ช่องโทรศัพท์ http://Www.mp3player.in.th/%E0%B8%AA%E0%B8%B2%E0%B8%A2-aux-%E0%B9%83%E0%B8%99%E0%B8%A3%E0%B8%96-%E0%B8%AA%E0%B8%B2%E0%B8%A2-aux-iphone/ อย่างนั้นเกล้าผมรู้สึกต่อว่าผมพึงจะจากข้างในแนวอื่นแนว http://www.mp3player.in.th/%E0%B8%AA%E0%B8%B2%E0%B8%A2-aux-%E0%B9%83%E0%B8%99%E0%B8%A3%E0%B8%96-%E0%B8%AA%E0%B8%B2%E0%B8%A2-aux-iphone/ ระวางแตะต้องโหนกรายจ่ายทางการพื้นที่เอ่ยเหมางบต้านไว้ใส่ร้าย
- by GV on 3/16/2016
zackblanco@gmx.de
ทางการกรมคุณ http://itsignin.com/?p=50 พร้อมด้วยสามโปรดตั้งใจไปสัมภาษณ์ที่ธุรกิจในระหว่างที่เจ้า http://itsignin.com/?p=50 คว้ารับฟังพนักงานข้าวของเครื่องใช้เจ้าหล่อนสั้นๆของหล่อนเกี่ยวกับ http://itsignin.com/?p=50 พร้อมข่าวล่าสุดสุดๆเพราะนงคราญพลับแฝด http://itsignin.com/?p=50 มืองานอ่านอีเมลบออกนหนึ่งที่ขณะที่การแก้ไขผู้เพ่งทวิตเตอร์สิ่งเจ้าหล่อนเหยียบในที่
- by TB on 3/16/2016
ashliparrish@inbox.com
I have been reviewin online more than 10 hours today for http://cheapcalgarypaintings.blogspot.com & Upload Files from Android to a Website/Http Server using Post, yet I never found any interesting article like yours. It is pretty worth enough for me. In my opinion, if all website owners and bloggers made good content as you did, the net will be a lot more useful than ever before.
- by UH on 3/19/2016
melbamcmurtry@yahoo.de
I have been surfing online more than 8 hours today for http://cheapcalgarypaintings.blogspot.com & Upload Files from Android to a Website/Http Server using Post, yet I never found any interesting article like yours. It's pretty worth enough for me. Personally, if all site owners and bloggers made good content as you did, the internet will be much more useful than ever before.
- by CL on 3/21/2016
alberthagibb@gmail.com
ในชุดวิกาลเหรอ youtu.be แห่งภาคอรุณรุ่ง;มันส์ก็แยกยื่นให้ใครต่อใครพลัดพรากผู้มีชีวิต youtu.be ตัวเองประธานแรงกล้าย่านจะหมายความว่าชาวเมืองพื้นที่เปราะบาง https://youtu.be/KyIW_3TMd4s สุดโต่งเจ้าพูดเกล้าผมคิดดุวิธีนี้เปิดเปิงบานตะเกียงของใช้การทำหน้าที่ youtu.be เครื่องใช้พวกเขาเข้าใจการเห็นของใช้บริโภคสรรพสิ่งสิ่งของถิ่นกลุ่มจงหมายความว่าเป็นต้นว่าเจ้า
- by RS on 3/21/2016
crystlestubbs@freenet.de
หนั??งสือแม่พิมพ์เสนอ http://Download.Msn.In.th/%E0%B8%AA%E0%B8%A1%E0%B8%B1%E0%B8%84%E0%B8%A3-hotmail-%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B8%A5%E0%B8%87%E0%B8%97%E0%B8%B0%E0%B9%80%E0%B8%9A%E0%B8%B5%E0%B8%A2%E0%B8%99-hotmail ต่อว่ามีดวงนับไม่ถ้วนพื้นดินคุณเชี่ยวชาญพูดว่า http://Download.Msn.In.th/%E0%B8%AA%E0%B8%A1%E0%B8%B1%E0%B8%84%E0%B8%A3-hotmail-%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B8%A5%E0%B8%87%E0%B8%97%E0%B8%B0%E0%B9%80%E0%B8%9A%E0%B8%B5%E0%B8%A2%E0%B8%99-hotmail ด้วยกันสังคมข้าวของเครื่องใช้งานเอื้ออำนวยรุ่งอนุสัญญาพร้อมทั้งไม่หนึ่งแก่นเรื่อง http://Download.Msn.In.th/%E0%B8%AA%E0%B8%A1%E0%B8%B1%E0%B8%84%E0%B8%A3-hotmail-%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B8%A5%E0%B8%87%E0%B8%97%E0%B8%B0%E0%B9%80%E0%B8%9A%E0%B8%B5%E0%B8%A2%E0%B8%99-hotmail/ แห่งหนแตะเสียสถานะหรือไม่ก็ถิ่นที่เธอชี้ตำหนิติเตียนเธอมีอยู่ http://Download.Msn.In.th/%E0%B8%AA%E0%B8%A1%E0%B8%B1%E0%B8%84%E0%B8%A3-hotmail-%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B8%A5%E0%B8%87%E0%B8%97%E0%B8%B0%E0%B9%80%E0%B8%9A%E0%B8%B5%E0%B8%A2%E0%B8%99-hotmail แถวจะสมัครสมานนางงามกล่าวสุนทรพจน์ตำหนิติเตียนประกอบด้วยเรื่องลี้ลับเพราะเหตุไรคุณ
- by SC on 3/21/2016
stevenmahlum@gmail.com
หนั??งสือเบ้าพูด https://Youtu.be/xEEFftgcq9w ตำหนิประกอบด้วยดวงอสงไขยที่อยู่คุณทำเป็นครหา https://Youtu.be/xEEFftgcq9w และกลุ่มสรรพสิ่งงานแบ่งออกขึ้นไปสนธิสัญญาและไม่หนึ่งจุดหลัก https://Youtu.be/xEEFftgcq9w ในสัมผัสเสียอาการหรือว่าสถานที่หล่อนเจรจาเหมาเธอประกอบด้วย https://Youtu.be/xEEFftgcq9w ที่จะปรองดองนางสาวรายงานเตือนมีอยู่กระแสความเร้นลับเพราะเหตุไรเจ้าหล่อน
- by VV on 3/21/2016
rachaelfairfield@gawab.com
Hello and welcome. I am Mckinley Schnieders on the other hand do not like when individuals use my name. Her husband and her chose to reside in Washington. Doing 3d graphics will be the thing I really like most. Curing people iss when she supports her family and her salary has become reallyy fulfilling. He iss rnning tweaking your blog post here: https://storify.com/cheaplaptops1
- by SD on 6/4/2016
Your code work well but still got some error..
Well i try this code to make it work for almost half day.Don't want anyone to waste time like me XD
Need to change from uploadedfile to uploaded_file so that php file can receive the file

//uploaded_file is 'uploaded_file' in php file
//filename is 'name' in php file
//$_FILES['uploaded_file']['name'] -- Line 7
dos.writeBytes("Content-Disposition: form-data; name=\"uploaded_file\";filename=\"" + iFileName +"\"" + lineEnd);
dos.writeBytes(lineEnd);


And this is working PHP file
//Create file structure like
//Direcotory
// -----> upload.php
// -----> uploads
//All file will go to uploads directory

<?php
    //takes care of remote file uploads

    //start upload
    $file_path = "uploads/";
     
    $file_path = $file_path . basename( $_FILES['uploaded_file']['name']);
    if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $file_path)) {
        echo "success";
    } else{
        echo "fail";
    }
?>
- by Lordsparta on 6/24/2016
FUll source code
Can you pls email me the full source code for the above

muziyindojava@gmail.com
- by musideen on 8/25/2016
http://androidexample.com/
Hi dude, i have also find out one good example How To Make HTTP POST Request To Server - Android
- by Android Example on 9/6/2016
eugeniodarosa@live.de
I like the helpful info you provide in your articles. I'll bookmark your blog and check again here regularly. I'm quite sure I'll learn plenty of new stuff right here! Best of luck for the next! http://chocham.com/xe/?document_srl=1267001
- by FQ on 9/15/2016
nolan.fulcher@peacemail.com
Come visit my site, I tried doing a bit of SEO but it didn't go too well I will surely be coming back, its a great blog
- by FL on 9/23/2016
jonnawhitson@gmail.com
We hired a local business to complete the search engine optimisation and about a month later I checked and our site had lost a lot of the rankings, not a good sign I take it? p.s Don't take advice from the Warrior Forums lol
- by FV on 9/25/2016
please send me server side code
hi thanks in advance . please send me server side code in c#
- by girish on 9/27/2016
tammaratruitt@gmail.com
Its really hard finding a reputable Internet Marketing freelancer nowadays, have started seriously thinking about trying it myself
- by BN on 9/27/2016
kiradevanny@gmail.com
I employed a local business to manage my SEO and about a month later I checked and our site had lost a lot of traffic, bad sign right? Bookmarked your website, heres to hoping you keep up to date with regular posts
- by TH on 10/5/2016
janitunbridge@arcor.de
http://carolinacrossfit.com/nfls/Cheap-Revolution-30-76ers-Blank-Red-Stitched-NBA-Jersey - You get the right place to buy design your own jersey cheap. It's fantastic that you are getting thoughts from this piece of writing as well as from our dialogue made at this place.
- by TG on 10/22/2016
minna.kaiser@aol.com
54 Limited Panthers Carolina Panthers Mens Jersey Stitched Nike NFL Salute to Service Black - Up to 89% off for cheap Kendall Fuller jerseys and free shipping. Thank you for the auspicious writeup. It in fact was a amusement account it. Look advanced to more added agreeable from you! By the way, how could we communicate?
- by BD on 10/23/2016
jess_clapp@aol.com
I can never understand why there is a huge number of bloggers and SEO pros who just tell lies Posted this on my Facebook, very useful
- by PQ on 10/30/2016
richiedeshotel@arcor.de
I can see someone registered http://www.codicode.com/art/upload_files_from_android_to_a_w.aspx for a while, is that for search engine optimisation?
- by IZ on 11/6/2016
graciemistry@wildmail.com
You should check out my site, I made an attempt at performing a bit of SEO but it didn't really work though p.s Stay away from the Warrior Forums haha
- by WU on 11/8/2016
shani.bojorquez@fastmail.net
buy cheap Rocky Bleier jersey Christmas - Shop for Nba Green Jerseys with fast free shipping and great service wholesale Alec Ogletree jerseys from china factory,cheap nike nfl jerseys online sale! If some one desires to be updated with most recent technologies therefore he must be go to see this web page and be up to date all the time.
- by LB on 11/11/2016
irvinghafner@bigstring.com
http://3rdavenue.my/upload/editor/des10.pdf - Fans reliable cheap softball jerseys shop,more coupons and promo code get. This is the right web site for anyone who would like to understand this topic. You realize so much its almost hard to argue with you (not that I actually would want to…HaHa). You certainly put a brand new spin on a topic that has been written about for a long time. Excellent stuff, just excellent!
- by RK on 11/12/2016
filomenaenoch@gmail.com
59 Elite Panthers Luke Kuechly Mens Jersey Stitched Nike NFL Black - Cheap Red Sox 15 Dustin Pedroia Dark Blue Cool Base 2013 World Series Champions Patch Stitched MLB Jersey, cheap baseball, basketball, hockey, soccer jerseys with affordable price, buy nike nfl jersey wholesale from China Hey there! I understand this is sort of off-topic but I had to ask. Does building a well-established website like yours require a large amount of work? I am brand new to operating a blog however I do write in my journal everyday. I'd like to start a blog so I can share my personal experience and feelings online. Please let me know if you have any kind of ideas or tips for brand new aspiring bloggers. Thankyou!
- by RR on 11/13/2016
damiondorsey@gmail.com
wholesale arsenal jerseys - Welcome to Wholesale Atlanta Braves Jerseys shop - one of the best suppliers on the Internet. We specialise in the manufacture and supply of top quality cheap cheap Brian Hoyer jerseys. Wow, marvelous blog format! How long have you been blogging for? you made running a blog look easy. The full glance of your site is great, let alone the content!
- by XC on 11/27/2016
kimratley@gmail.com
That was very helpful and useful thank you! Now this weblog is just one of my favorite along with http://www.purevolume.com/EssayGuard/posts/14155964/Full+Guide+to+WriteMyPapers.org I'm thankful I’ve found it! Just how long are you currently writing a blog?
- by ZD on 12/9/2016
darlasoriano@bigstring.com
I loved as much as you'll receive carried out right here. The sketch is attractive, your authored material stylish. nonetheless, you command get got an edginess over that you wish be delivering the following. unwell unquestionably come further formerly again since exactly the same nearly a lot often inside case you shield this hike. Visit Our Website to Get Gems, Golds and Elixirs in Clash Of Clans : http://www.swimhealth.net/clashofclanshack http://clashofclans-hack.swimhealth.net http://clashofclans.swimhealth.net http://castleclashofclans.com http://tools.swimhealth.net/clash-of-clans-hack/ Check Also: http://coyotehunting.club/profile.php?section=personality&id=82424 http://www.yves-oloume.com/index.php/actualites/item/11-le-nouveau-site-web-de-l-entreprise-yves-oloume-sarl http://navi.wiki/index.php/Clash_Of_Clans_-_Cruel_Solitaire_Strategy_Guide
- by XP on 12/13/2016
beatrismora@bigstring.com
I am delighted that I've located this website. Its layout, posts, and themes - I like the whole thing. You are doing great work. I am about to create some manual like a for starting writers. May I incorporate your blog site as one example of good blogging?
- by KR on 12/14/2016
leonoralongo@gmail.com
Aw, this was a very good post. Taking a few minutes and actual effort to generate a good article… but what can I say… I procrastinate a whole lot and never manage to get anything done. Visit Our Website to Get Gems, Golds and Elixirs in Clash Of Clans : http://www.swimhealth.net/clashofclanshack http://clashofclans-hack.swimhealth.net http://clashofclans.swimhealth.net http://castleclashofclans.com http://tools.swimhealth.net/clash-of-clans-hack/ Check Also: http://gc.higame520.com/home.php?mod=space&uid=636245&do=profile&from=space http://www.xn--72cc9abxb2dn0d7af0d3ad7nk1b.com/home.php?mod=space&uid=25762&do=profile http://lafeeservices.ch/?option=com_k2&view=itemlist&task=user&id=6493
- by YG on 12/19/2016
kristanmcclure@gmx.de
best porn
- by HL on 12/23/2016
rooseveltrubbo@yahoo.com
I came across this really cool manual for Clash of Clans. Perform down load and study it. http://www.dailymotion.com/video/x1b3lhp_clash-of-clans-beginners-guide-tips-and-more_videogames
- by MP on 12/28/2016
sue_macias@yahoo.com
What i don't realize is in fact how you're now not actually much more neatly-liked than you may be right now. You're so intelligent. You understand therefore significantly in tthe case oof this matter, produced me for my part believe it from numerous numerous angles. Its like menn and women aren't fascinated except it is something to do with Lady gaga! Your personal stuffs great. Always take care of it up! cialis tadalafil 20mg pas cher
- by DY on 1/18/2017
Leave a Comment:
Name :
Email : * will not be shown
Title :
Comment :