What is boundary in while uploading image through web api request?

I am using httpwebrequest api to send image to server what is the boundary everybody is giving boundary as something like this : string boundary = "---------------------------" + DateTime.Now.Ticks.ToString("x");
and where to attach file in httpwebrequest.. in which line

my code is something like this but I do not know how to upload image.

var request = (HttpWebRequest)WebRequest.Create ("http://hallpassapi.jamsocialapps.com/api/profile/UpdateStudentAboutInfo");
request.Method = "POST";
var data = Encoding.ASCII.GetBytes (postData);
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = data.Length;
request.Headers[HttpRequestHeader.Authorization] = "Bearer A5FFxlV0lyfTXsi-zveAENRzOBqcj_KQUIOUX92mQKDB3w2gMwWd3Dd4gGkN8HgujWLZx0_YJeO_AEYBAxTgZWuHdXuM02SO7DOA_dzdSWwBQrPo_PdSe_fTM6_qXkj8CBwJqHz_wqiBKr0jct23gz-X92SbMk1_s9XPbwyxE3b-CsHV8kkZsL7Wy1clBXZg6PdXO6nnxQ0YAmAIFRlNIqav7mnW07vxRRPEMHkNWDgCXfyS6hh6MV1VZUyUXx00tQQPSuk1UTjhmwMdvHgQdxkv1RPJlCV5iyIUqGB03-yVadqlm9LdbAJNjTI4Zmb8fNjhnsLkqEsuf61fhWZDUTPF5VDaL0x_zEwtA0Q9UFbSGUjAkybJ_BByqAETn0TkR4ZfZzvJACB8qBrKUz1UB63GEqb6QN24BLx4uOgsHiqEfsLh2EzY_ETATOa7mpAm6Lrgeb6ZNYS38vCj0yNYkIGKuLHPBOMRP-DQFcDH15g" ;
using (var stream = request.GetRequestStream ()) {
stream.Write (data, 0, data.Length);
}

        var response = (HttpWebResponse)request.GetResponse ();

        var responseString = new StreamReader (response.GetResponseStream ()).ReadToEnd ();
        Console.WriteLine("sen:{0}",responseString);
Tagged:
Sign In or Register to comment.