Get Custom Field File URL in transformation

Carson Wong asked on August 8, 2016 20:36


I have a custom field in a page type. This field takes in some content from the Media library (pdf or image). In a transformation, I want to access the file as a link. I've tried Eval() and GetFileUrl() but both are not working

Correct Answer

Rui Wang answered on August 8, 2016 20:49

Hi Carson

What kind of data type did you set this field to be? For example, the field name is "FilePath", you set it as "Text" data type and use "Media selector" form control. The data been stored would be the path to the image/file like "/mysite/media/folder/filename.jpg". Then in the transformation, you can use <%# Eval("FilePath") %> for ASCX transformation or {%FilePath%} for HTML.

Full example would be something like <a href="{%FilePath%}">Link</a> or <a href='<%# Eval("FilePath") %>'>Link</a>

1 votesVote for this answer Unmark Correct answer

Recent Answers

Carson Wong answered on August 8, 2016 21:17

Thank you!

0 votesVote for this answer Mark as a Correct answer

Alistair DeJonge answered on September 15, 2016 00:28 (last edited on March 24, 2018 12:15)

So should it be {%FieldName.FilePath|(user)zbynekh|(hash)44395b840c6292d40c930f4759d1a25aacf7778a8cd5433ed86cda64590b4ae6%}, because that is not working for me either.

0 votesVote for this answer Mark as a Correct answer

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