SHARE
TWEET

Untitled

a guest Feb 19th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. request.AddParameter("text/plain", body, ParameterType.RequestBody);
  2.      
  3. public static void UploadFile(string bearer)
  4.     {
  5.         var client = new RestClient("...");
  6.         var request = new RestRequest(Method.POST);
  7.         request.AddHeader("Authorization", "Bearer " + bearer);
  8.         request.AddHeader("cache-control", "no-cache");
  9.  
  10.         var imageLenngth = new FileInfo(@"...").Length;
  11.  
  12.         request.AddHeader("Content-Type", "image/jpeg");
  13.         request.AddHeader("Content-Length", imageLenngth.ToString());
  14.  
  15.         byte[] body = File.ReadAllBytes(@"...");
  16.  
  17.         request.AddParameter("text/plain", body, ParameterType.RequestBody);
  18.  
  19.         IRestResponse response = client.Execute(request);
  20.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top