0

I want to be able to upload a file to the cms, to a field on a page. Then from the actually site page, have a link to download said file

  • Hi! I believe that you need to add more information to your question! Which CMS, for example? What code did you try to write, and how it is non working? Help us helping you! – Carlo Mar 18 '20 at 11:10

1 Answers1

0

I think that a nice way to do this is with kentico page attachments. On the page in the content tree you can go to attachments. There you can add for example a pdf file. This can then be retrieved on the backend and then you can create a link on the view with it. Also see this link about displaying the page attachments. You can also take a look at attaching file groups to pages.

Example:

Controller:

viewModel.FileUrl = treeNode.AllAttachments?.FirstOrDefault()?.GetPath() ?? string.Empty;

View:

<a href="@Model.FileUrl" target="_blank">Download file</a>
A. van Hugten
  • 715
  • 5
  • 16