Recently upgrade a site to 2.9.2 and Freeform 4.2.1 PHP 5.3.28 and all is going well until we spotted this oddity.

The Notifications templates setup for the customer and admin emails use this:

{attachments} <a href="{fileurl}">{filename}</a> {/attachments}

This used to link back to the file but now for some reason it's encoding the URL



I've no idea what could be causing this, I tried a simple {exp:freeform:entries} tag and it did spit out the filename but no full URL so I cant even test where the fault is.

Seriously, I'm looking for a needle in a haystack here any help greatly appreciated.

  • I'd also like an answer to this. I hadn't realised that this was happening because the recent freeform forms I've built have been set to attach the files to the notification email rather than linking to them, but when I ran a test (thinking I'd be able to throw a simple solution over to you) I found the same issue. Except that mine seemed to be even worse; with attachments disabled and the link set up in the notification template (with allow HTML 'yes'), the link, when it arrives in Apple Mail, begins with x-webdoc://409C5417-105C-40E2-B029-F86F9B55CC36/ which of course is a mess.
    – RickL
    Mar 4, 2015 at 12:17
  • Start here: /system/expressionengine/third_party/freeform/libraries/Freeform_notifications.php starts on line 52. I would be curious about what the $template_data looks like on line 201: ob_start(); var_dump($template_data); $test = ob_get_clean(); then have it email the $test var as the body contents. Then continue to look at line 401 and then at 469. Mar 4, 2015 at 16:10

1 Answer 1


This is a known (and reported) issue with {fileurl} where the URL gets URL-encoded, leading to URL entities in email notifications.

In the meantime, you can remove the URL-encoding by looking for the following like (around line 1747) in /system/expressionengine/third_party/freeform/default_fields/freeform.ft_file_upload.php:

$url        = urlencode($upload_prefs['url'] . $file_data['filename']);

...and changing it to

$url        = $upload_prefs['url'] . $file_data['filename'];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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