Documentation > CMS Template API Library > Asset > SaveAssetAsAttachment(String,Asset,Boolean)
SaveAssetAsAttachment
Used to save an uploaded asset's file contents to another asset as an attachment.
public System.Void SaveAssetAsAttachment(String,Asset,Boolean)
Parameters
Name | Description | Type |
---|---|---|
key | The name to save it under. Don't include "upload#". If null or an empty string is passed, we will use the key in the object. | System.String |
uploadedBinaryAsset | The asset. Must have been created via upload. | CrownPeak.CMSAPI.Asset |
makeBinaryLinkField | If true will be setup as a "binary link field". | System.Boolean |
Code Example
C#
Sample:
Asset image = Asset.Load("/Assets/someimage.jpg"); Assets imageHolder = Asset.Load("/Assets/imageholder.jpg"); imageHolder.SaveAssetAsAttachment("theimage", image, true);