FbPhoto IGraphApi.UploadPhoto(PhotoRqst photo, string token, Stream fileStream) { var fb = _config.ApiBaseUrl; var pageId = photo.pageId; var url = $"{fb}/{pageId}/photos?published=false&access_token={token}"; using (var mcontent = new MultipartFormDataContent("---------------------------" + DateTime.Now.Ticks.ToString("x"))) { var fcontent = new StreamContent(fileStream); fcontent.Headers.ContentType = new MediaTypeHeaderValue(photo.fileType); mcontent.Add(fcontent, "source", photo.fileName); var info = _web.Post(url, onFbError, mcontent, new { id = "" }); return(new FbPhoto { Id = info.id }); } }