Print this page

Render attachment from Blob in Visualforce page

Knowledge Article Number 000186484
Description For a given article, if you are trying to display all the attachments from the File fields so that Users can click on a file name which allows download functionality.
The below mentioned document and sample code will allow this.
Resolution
If your article type has a File field, you can allow users to download the field's contents. In the following example, the article type is Offer, the name of the File field is my_file, and the text that appears as a link is Click me:

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_outputLink.htm
 
<apex:outputLink value="{!URLFOR($Action.Offer__kav.FileFieldDownload,
Offer__kav.id, ['field'=$ObjectType.Offer__kav.fields.my_file__Body__s.name])}">Click
me</apex:outputLink>




promote demote