Documentation > CMS Template API Library > Asset > CreateFromHex(String,Asset,String)
CreateFromHex
Create a binary (uploaded asset) from a Hex string.
public CrownPeak.CMSAPI.Asset CreateFromHex(String,Asset,String)
Returns
A new Asset object if it is successful, null if not successful, check context.Error
Parameters
Name | Description | Type |
---|---|---|
label | The name of the asset - must be unique. | System.String |
saveLocation | The folder to store the asset. | CrownPeak.CMSAPI.Asset |
hexString | A string of two digit hex numbers representing the file bytes. | System.String |
Code Example
C#
Sample:
Asset data = Asset.Load("/Site/scripts/data"); string hex = data["data_hex"]; Asset.CreateFromHex("hex.jpg",asset.Parent, hex);