Documentation > CMS Template API Library > Asset > SaveHexAsAttachment(String,String,String)

SaveHexAsAttachment

Save a new attachment using a hex string data as a source.

public System.String SaveHexAsAttachment(String,String,String)


Returns

The CMS path to the attachment if it is successful, null if not successful, check context.Error

Parameters

NameDescriptionType
key The key that will be used to save the path in the content properties. System.String
extension The filename extension to use. System.String
hexString Hex encoded bytes. Just a string of two place hex numbers, no dashes or other formatting. System.String

Code Example

C#

Sample:
Asset data = Asset.Load("/Site/scripts/data");
string hex = data["data_hex"];

string path = asset.SaveHexAsAttachment("image",".jpg",hex);

Connect with Crownpeak