1

I am stuck at a point where I have to give a link to the user on the UI which on getting clicked will download a pdf and video files.

I have placed these files as static resources and I am trying to retrieve them using the "anchor" tag of html5.

I have set the href property of the tag as follows:

pdf file - {!URLFOR($Resource.ToolName_StaticResource,'TrainingGuide/Admin.pdf')}

video file - {!URLFOR($Resource.ToolName_StaticResource,'TrainingGuide/AdminVideo.wmv')}

But unfortunately, due to some reason this doesn't work.

Is the href value incorrect? Or, is there something else that I am missing?

Any help would be appreciated.

Thanks.

2 Answers 2

1

Try this, I tested it on my sandbox and works as expected:

<apex:outputLink value="{!URLFOR($Resource.pdfFileName)}" target="_blank">PDF Name</apex:outputLink>
<apex:outputLink value="{!URLFOR($Resource.videoFileName)}" target="_blank">Video Name</apex:outputLink>
1
  • Thanks Ruslan..I still don't understand why it wasn't working when I placed it within a zipped folder in the static resource section. Thanks a lot.
    – juhi
    May 16, 2015 at 17:57
0

Try this:

<apex:outputLink value="{!URLFOR($Resource.ToolName_StaticResource,'TrainingGuide/Admin.pdf')}" target="_blank">PDF Name</apex:outputLink>
<apex:outputLink value="{!URLFOR($Resource.ToolName_StaticResource,'TrainingGuide/AdminVideo.wmv')}" target="_blank">Video Name</apex:outputLink>
4
  • Thanks, but it doesn't work. A new window opens up which says that "WebPage is not available".
    – juhi
    May 15, 2015 at 9:44
  • Sorry... did some reading and found this <a href="/servlet/servlet.FileDownload?file={!attachment.id}" download="{!attachment.name}">{!attachment.name}</a>
    – Tim
    May 15, 2015 at 9:49
  • But I need to use a file from static resource and therefore I cannot fetch that file using "attachment.name"
    – juhi
    May 15, 2015 at 11:34
  • i also facing this issue, i want to download from static resource, as i click submit button Jan 8, 2016 at 10:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .