static string uploadFile(string currentFile) { string fileName = Path.GetFileName(currentFile); var uploadHref = GetJsonFromURL(GetUrlUpload + "?" + pathOut + fileName); using (Stream stream = new StreamReader(currentFile).BaseStream) { using (MyHttpClient httpClient = new MyHttpClient()) { var response = httpClient.PutAsync(uploadHref.href, new StreamContent(stream)).Result; } } return(pathOut + fileName); }