How to render file attachment content on page.

Gaurav Saxena asked on July 23, 2021 15:14

I have create new page type which is having only 1 field of datatype File. In that I have set the Visibility condition: true. Now I am attaching the html or images using the Pages application. But when I access that page it dont show attachment content. How to do that?

In old version we use to have CMS.File page type which can be used to achieve the same but it is not available in Kentico 13.

Am I missing something ? Please help

Thanks!!

Recent Answers


Sean Wright answered on July 27, 2021 04:00

The instructions to display Page Attachments can be found in the documentation.

These steps are unrelated to the Visibility condition of the Page Type field - that is only used in the Content Management application form for the content of the Page Type, not the site where the content is displayed to visitors.

0 votesVote for this answer Mark as a Correct answer

Gaurav Saxena answered on July 27, 2021 08:52

Sorry for not being so clear. I am looking forward to see the contents inside that attachment instead of list of attachments. I have already seen the above documentation but it don't talk about how to stream contents of attached file. Have I missed any point?

Please suggest !!

0 votesVote for this answer Mark as a Correct answer

Sean Wright answered on August 14, 2021 19:28

Gaurav,

it don't talk about how to stream contents of attached file

Try using CMS.DocumentEngine.AttachmentBinaryHelper.GetAttachmentBinary()

Then use that binary data of the attachment as you want, which is unrelated to Kentico Xperience and more a question of how you want to process it with ASP.NET Core.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.