Trying to use the REST SDK to upload a file to a gallery. Everything looks like it works, but the file seems corrupted when I try download/view it from my community. I'm not entirely how to pass in the filedata as a byte array as the method asks for a string and not sure I'm encoding it correctly.
byte[] fileData = System.IO.File.ReadAllBytes(myPdfPath); // Add as a new media item to Telligent var response = host.PostToDynamic(2, "media/{mediagalleryid}/files.json", false, new RestPostOptions { PathParameters = new System.Collections.Specialized.NameValueCollection { { "mediagalleryid", "246" } }, PostParameters = new System.Collections.Specialized.NameValueCollection { { "Name", resourceFileName }, { "FileName", resourceFileName}, { "FileData", String.Join(" ", fileData)}, { "ContentType", MimeMapping.GetMimeMapping(resourceFileName)}, { "Tags", tags}, { "Description", description} } });
Updated
[edited by: Luke R Davidson at 11:25 AM (GMT 0) on Fri, Dec 18 2020]