First thing first, we need to use the namespace, using Microsoft.SharePoint.Client.
byte[] bytes = IO.File.ReadAllBytes(strFilePath); IO.MemoryStream mStream = new IO.MemoryStream(bytes); SP.File.SaveBinaryDirect(this.ctx, strServerRelativeUrl, mStream, true);
Remember, SaveBinaryDirect is use to upload Forms, & Views. You can’t upload a ListItem like, Document Library by this process. For other file types, plz check my other blog (will be posting shortly)