Kentico 13 API Simpan Lampiran

// Gets the first page located under /Articles
TreeNode page = new DocumentQuery<TreeNode>()
                    .Path("/Articles", PathTypeEnum.Children)
                    .OnSite("MySite")
                    .Culture("en-us")
                    .TopN(1)
                    .FirstOrDefault();

if (page != null)
{
    DocumentAttachment attachment = null;

    // Prepares the path of the file
    string file = System.Web.HttpContext.Current.Server.MapPath("/FileFolder/file.png");

    // Inserts the attachment into the 'ArticleTeaserImage' field and updates the page
    attachment = DocumentHelper.AddAttachment(page, "ArticleTeaserImage", file);
    page.Update();
}
Lakshan Convertium