Skip to content

Email Template - Example-Template.cshtml FieldType.FileUpload.cshtml doesn't support multiple #691

@mistyn8

Description

@mistyn8

uForms 9.1.1 and Umbraco 9.1.2

I know it's only a sample template but...

@switch (field.FieldType)
                                    {
                                        case "FieldType.FileUpload.cshtml":
                                            var fileUploadValue = field.GetValue();
                                            if (fileUploadValue != null && !string.IsNullOrEmpty(fileUploadValue.ToString()))
                                            {
                                                <a href="@siteDomain/@fileUploadValue" target="_blank" style="color: #00AEA2;">@fileUploadValue</a>
                                            }
                                            break;

should perhaps now be

switch (field.FieldType)
{
	case "FieldType.FileUpload.cshtml":
		foreach (var fileUploadValue in field.GetValues())
		{
			if (fileUploadValue != null && !string.IsNullOrEmpty(fileUploadValue.ToString()))
			{
				<a href="@siteDomain@fileUploadValue" target="_blank" style="color: #00AEA2;">@fileUploadValue</a>
			}
		}
		break;	

Seems to work for single or multiple (as single still gives a single item array for field.GetValues())

Also of note.. @siteDomain seems to include the trailing "/" now.. hence @siteDomain@fileUploadValue

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions