0

I've built a visualforce page that has a button that creates and stores a text file as an attachment on a custom object. I'd like for this text file to be available as a download link on the visualforce page, but am having issues creating this download link.

Has anyone done this before? Is it possible?

1 Answer 1

0

Yes, it's possible. You just need to query the attachment record or otherwise obtain its ID, then construct a link to it:

<a  download="{!AttachmentName}" 
    href="{!URLFOR($Action.Attachment.Download, AttachmentId)}">
    Download
</a>

You may need to make some adjustments to this, but it should work without too much modification.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.