0 Replies Latest reply on Apr 7, 2016 7:05 AM by umesh

    Issue with Images upload to the temporary location




      I am trying to upload image at temporary location but not getting that location. Below is my code,



      jivePictureUrl = ConfigurationManager.AppSettings["JiveURI"];



      string credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes(ConfigurationManager.AppSettings["apiUsername"] + ":" + ConfigurationManager.AppSettings["apiPassword"]));


      string boundary = "----------------------" + DateTime.Now.Ticks.ToString("x");


      string HeaderTemplate = "--{0}\r\nContent-Disposition: form-data; name=\"{1}\"; filename=\"{2}\"\r\nContent-Type: {3}\r\n\r\n";


      string formKey = "filename";


      string header = String.Format(HeaderTemplate, boundary, formKey, "defProfileImage.jpg", "image/jpg");


      byte[] headerbytes = Encoding.UTF8.GetBytes(header);


      string responseString = string.Empty;


      HttpWebRequest request = (HttpWebRequest)WebRequest.Create(jivePictureUrl);






      "multipart/form-data; boundary=" + boundary;


      HttpRequestHeader.Authorization] = "Basic " + credentials;


      using (Stream requestStream = request.GetRequestStream())


      byte[] newlineBytes = Encoding.UTF8.GetBytes("\r\n");


      byte[] endBytes = System.Text.Encoding.UTF8.GetBytes("--" + boundary + "--");


      //ts.TraceInformation("Request stream complete");

      using (WebResponse response = request.GetResponse())



      Below is out put from watch window, I am not able to get the location.  



      Can you please help me?