Documentation > CMS Template API Library > Asset > SaveBase64AsAttachment(String,String,String)
SaveBase64AsAttachment
Save a new attachment using base64 data as a source.
public System.String SaveBase64AsAttachment(String,String,String)
Returns
The CMS path to the attachment if it is successful, null if not successful, check context.Error
Parameters
| Name | Description | Type |
|---|---|---|
| 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 |
| base64String | Base64 encoded bytes as a string | System.String |
Code Example
C#
Sample:
Asset data = Asset.Load("/Site/scripts/data");
string base64data = data["data_base64"];
string path = asset.SaveBase64AsAttachment("image",".jpg",base64data);