Displaying images uploaded using BizForm in a transformation

   —   
This article describes how to access files saved in custom forms
The image file can be displayed in a transformation using the following syntax:

<img src="~/CMSModules/BizForms/CMSPages/GetBizFormFile.aspx?filename="+MyCustomFunction(Eval("MyCustomField"))>

In your custom function "MyCustomFunction" you need to parse the ID of the file, i.e. you receive something like /0dbf18f9-6bac-4578-b86b-d2a11ca111cc.jpg/image.jpg , so you need to cut out the "/image.jpg".

At this stage will the image be displayed for users, which are Editors of the site. If you want to display the files for everyone, please follow this:

You can display the images for public users by altering the file "~\CMSModules\Bizforms\CMSPages\GetBizFormFile.aspx.cs". You need to alter the following line:

if (CurrentUser != null && CurrentUser.IsAuthorizedPerResource("cms.form", "ReadData"))

to

if (CurrentUser != null)

or you can also grant everyone reading permissions in CMS Site manager -> Administration -> Permissions -> <Permission type: Modules , Site: <your site>, Permission matrix: BizForms>. You need to check the Read data and Read form permissions for Everyone. Recommended is the second approach, since it doesn’t involve altering standard Kentico modules.

See also:

Applies to: Kentico CMS 4.0
Share this article on   LinkedIn

Juraj Ondrus

Hi, I am the Technical support leader at Kentico. I'm here to help you use Kentico and get as much as possible out of it.