Kentico Version Upgrade (11 to 12) Error: getFileUrl not working

nirmal shrma asked on November 15, 2019 08:37

hi, after upgrade kentico 9 to 12 i use getimage in place of getfileurl. it is working fine. but whenever i need url of image or mp4 file. i can not use it. what is best solution. one place i saw getattachment return url but how to find guid and which type guid it takes. please resolve asap.

thanks in advance nirmal

Recent Answers


Juraj Ondrus answered on November 15, 2019 09:04

The GetFileUrl transformation method was removed in Kentico 11. You need to use the API changes documentation and change the code, so you need to use GetAttachmentUrlByDocumentId instead. The file is usually uploaded into some page type field - some file uplaoder. this field holds the file's GUID, so you need to pass the field value into the transformation method. For example: <%# GetAttachmentUrlByDocumentId(Eval("AttachmentFileName"), Eval("AttachmentDocumentID")) %>

0 votesVote for this answer Mark as a Correct answer

nirmal shrma answered on November 15, 2019 09:47

thank you juraj but i am new in kentico could you please tell me where i can find attachmentdocumentid and attachmentfilename my table structure is bellow:

i have four field in table VideoId (autogen column) Header test type Image FileType MP4Video FileType

myTransform is below

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on November 15, 2019 11:34

I assume you are doing this in some transformation. Please, see this documentation on writing transformations.. If the file field is some page type field, then you can use the field name in the transformation as a parameter: <%# GetAttachmentUrlByGUID(Eval("AttachmentColumnName"), "< custom_file_name >") %>
I would like to also like to suggest to consider taking some training to learn how things work in Kentico.

0 votesVote for this answer Mark as a Correct answer

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