Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- request.AddParameter("text/plain", body, ParameterType.RequestBody);
- public static void UploadFile(string bearer)
- {
- var client = new RestClient("...");
- var request = new RestRequest(Method.POST);
- request.AddHeader("Authorization", "Bearer " + bearer);
- request.AddHeader("cache-control", "no-cache");
- var imageLenngth = new FileInfo(@"...").Length;
- request.AddHeader("Content-Type", "image/jpeg");
- request.AddHeader("Content-Length", imageLenngth.ToString());
- byte[] body = File.ReadAllBytes(@"...");
- request.AddParameter("text/plain", body, ParameterType.RequestBody);
- IRestResponse response = client.Execute(request);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement