Quantcast
Channel: DevNet Questions
Viewing all articles
Browse latest Browse all 8836

Need to Upload a PDF file Using Kentico 10 API methods - DocumentHelper.AddAttachment

$
0
0
Hello,I am getting @The given path's format is not supported.@ error while uploading a pdf file using API methods. looks like I am missing something. need help to identify the issue.Code to Upload a pdf document// Creates a new page of the @CMS.File@ page type TreeNode newPage = TreeNode.New(SystemDocumentTypes.File, tree); // Sets the properties of the new page newPage.DocumentName = System.IO.Path.GetFileName(filename); newPage.DocumentCulture = @en-us@; // Inserts the new page as a child of the parent page newPage.Insert(parentPage); // Add the attachment to the CMS_Attachment table **var file = DocumentHelper.AddAttachment(newPage, @AttachmentGUID@, filename);** //Associate the attachment with the document in the CONTENT_File table newPage.SetValue(@FileAttachment@, file.AttachmentGUID); //Save the changes to the database newPage.Update(); Thanks, Siva

Viewing all articles
Browse latest Browse all 8836

Trending Articles