data link in email template

How to display uploaded file links in ChronoForms email templates.

Overview

The issue occurs because the file data is not properly referenced in the email template, often due to the email action running before the file upload action completes.
Ensure the Email action is placed after the Upload Files action in the form workflow. Then, use the correct placeholder in the template, such as the full URL path combined with the file name variable.

Answered
PU PURINA 15 Nov, 2014
I have a trouble with entering exact sentence in email template of the uploaded file link.

I have this:
<table>
<tr><td>Name</td><td>{name}</td></tr>
<tr><td>Email</td><td>{email}</td></tr>
<tr><td>Subject</td><td>{subject}</td></tr>
<tr><td>Message</td><td>{message}</td></tr>
<tr><td>File Label</td><td>{file6}</td></tr>
<tr><td>{label}</td><td>{progress_bar}</td></tr>
<a href={file6}/a>
<div><img src='{file6}' /></div>
</table>

and I see no result of the link or img. I have - file6 as name of the file.

Thanks for help. JIRI
Gr GreyHead 16 Nov, 2014
Hi JIRI,

Please see this FAQ. The FAQ is for CFv4 but I think ti will still work in CFv5 - if not, add a Debugger action to see exactly where the file data is being saved.

Bob
PU PURINA 16 Nov, 2014
good morning, yes I made it by this FAQ, but there is in debug visible, that link is empty: here is debug

Data Array

Array
(
    [option] => com_chronoforms5
    [chronoform] => Zasletedataktisku
    [event] => submit
    [Itemid] => 
    [name] => JIRI ZUJIC
    [email] => jiri@zujic.cz
    [subject] => jkkjkj
    [message] => dlfjsldkfj
    [submit5] => Odeslat
    [ip_address] => 31.30.55.42
    [file6] => 20141116110807_kon.jpg
)

Array
(
    [file6] => Array
        (
            [name] => 20141116110807_kon.jpg
            [original_name] => kon.jpg
            [path] => /var/www/clients/client2/web8/web/tisky/20141116110807_kon.jpg
            [size] => 40209
            [link] => http://www.tygrtisk.cz/tisky/20141116110807_kon.jpg
        )

)

Errors

Array
(
)

Debug Info

Array
(
    [1] => Array
        (
            [Email] => Array
                (
                    [0] => An email with the details below was sent successfully:
                    [1] => To:zujic@tygrtisk.cz
                    [2] => Subject:jkkjkj
                    [3] => From name:JIRI ZUJIC
                    [4] => From email:jiri@zujic.cz
                    [5] => CC:
                    [6] => BCC:
                    [7] => Reply name:
                    [8] => Reply email:
                    [9] => Attachments:
                    [10] => Body:
<table>
<tr><td>Name</td><td>JIRI ZUJIC</td></tr>
<tr><td>Email</td><td>jiri@zujic.cz</td></tr>
<tr><td>Subject</td><td>jkkjkj</td></tr>
<tr><td>Message</td><td>dlfjsldkfj</td></tr>
<tr><td>File Label</td><td></td></tr>
<tr><td></td><td></td></tr>
<a href='' ></a>
</table><br /><br />IP: 31.30.55.42
                )

        )

    [3] => Array
        (
            [Files Upload] => Array
                (
                    [0] => Upload routine started for file upload by : file6
                    [1] => /var/www/clients/client2/web8/web/tisky/20141116110807_kon.jpg has been uploaded successfully.
                )

        )

)
Gr GreyHead 16 Nov, 2014
Hi JIRI,

I was wrong it has changed a bit in CFv5.

There are several ways to handle this.

a) If the file path is always the same you can use
<img src='http://www.tygrtisk.cz/tisky/{file6}' />


b) If you want full control, and you aren't using the Rich Text Editor for the Email template, you can use
<img src='<?php echo $form->files['form6']['link']; ?>' />


c) Or lastly you could add a Custom Code action with this code in it
<?php
$form->data['file6_url'] = $form->files['form6']['link'];
?>
and then put {file6_url} into the template.

Bob
PU PURINA 16 Nov, 2014
There is change, but email is still not showing the link. I need link instead of the picture, because we are getting more pdf files then jpg. I added custom code in the end of the custom code sentence and nothing. Also I tried to add hyperlink for data or img src as you helped and also nothing. I am lost sorry. here is the last debug>

Data Array

Array
(
[option] => com_chronoforms5
[chronoform] => Zasletedataktisku
[event] => submit
[Itemid] =>
[name] => JIRI ZUJIC
[email] => jiri@zujic.cz
[subject] => jkkjkj
[message] => 'ALSL;
[submit5] => Odeslat
[ip_address] => 31.30.55.42
[file6] => 20141116123543_jh.jpg
)

Array
(
[file6] => Array
(
[name] => 20141116123543_jh.jpg
[original_name] => jh.jpg
[path] => /var/www/clients/client2/web8/web/tisky/20141116123543_jh.jpg
[size] => 138978
[link] => http://www.tygrtisk.cz/tisky/20141116123543_jh.jpg
)

)

Errors

Array
(
)

Debug Info

Array
(
[1] => Array
(
[Email] => Array
(
[0] => An email with the details below was sent successfully:
[1] => To:zujic@tygrtisk.cz
[2] => Subject:jkkjkj
[3] => From name:JIRI ZUJIC
[4] => From email:jiri@zujic.cz
[5] => CC:
[6] => BCC:
[7] => Reply name:
[8] => Reply email:
[9] => Attachments:
[10] => Body:
<table>
<tr><td>Vaše jméno</td><td>JIRI ZUJIC</td></tr>
<tr><td>Email</td><td>jiri@zujic.cz</td></tr>
<tr><td>Předmět</td><td>jkkjkj</td></tr>
<tr><td>Zpráva</td><td>'ALSL;</td></tr>
<tr><td>Soubor k nahrání</td><td></td></tr>
<tr><td></td><td></td></tr>
</table>

<a href='http://www.tygrtisk.cz/tisky/' >http://www.tygrtisk.cz/tisky/</a>
<img src='http://www.tygrtisk.cz/tisky/' /><br /><br />IP: 31.30.55.42
)

)

[3] => Array
(
[Files Upload] => Array
(
[0] => Upload routine started for file upload by : file6
[1] => /var/www/clients/client2/web8/web/tisky/20141116123543_jh.jpg has been uploaded successfully.
)

)

)
Gr GreyHead 16 Nov, 2014
Hi JIRI,

Do you have the Email action *after* the Upload Files action? If you do this should work OK
<a href='http://www.tygrtisk.cz/tisky/{file6}' />click here</a>

Bob
PU PURINA 16 Nov, 2014
Answer
OF COURSE THANKS !!!!!!!!!!!!!!!!!!!!!!! will buy you coffee 😀
PU PURINA 16 Nov, 2014
And what about multiple files? Or zip it before uploading?
Gr GreyHead 16 Nov, 2014
Hi JIRI,

Please see this FAQ which was written for CFv4 to let you zip a number of uploaded files. It might need updating a little for CFv5.

Bob
This topic is locked and no more replies can be posted.