- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
โ12-10-2021
09:53 AM
How To Read a Binary File In The CMS
I was wondering how do you read a binary file (i.e. an excel file, text file, ect) from within a template. Either through an attached or uploaded asset.
--
David Greenberg
Customer Support Engineer
## If Iโve helped, accept this response as a solution so that otherโs can find is more quickly in the future.
## Have thoughts on Crownpeak products? We'd love to hear them. Speak with the Crownpeak Product Team..
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
โ12-10-2021
09:54 AM
To read an uploaded asset you will need to use the following code:
Read an asset uploaded into the CMS
System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(BinaryFile.LoadAsBase64(xmlAsset.Id.ToString())))
Read an asset attached to an asset
System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(BinaryFile.LoadAsBase64(asset["attachedFileFieldName"])))
--
David Greenberg
Customer Support Engineer
## If Iโve helped, accept this response as a solution so that otherโs can find is more quickly in the future.
## Have thoughts on Crownpeak products? We'd love to hear them. Speak with the Crownpeak Product Team..
- Tags:
- To

