Attach file to email (full absolute path)

How to attach a file to an email without hardcoding the document root path in ChronoForms.

Overview

The issue arises when needing to dynamically reference the server's document root for file attachments instead of using a fixed path.
Use the {path:front} variable within the attachment filename field to automatically resolve the correct path to the ChronoForms directory.

Answered
ChronoForms v8
bc bcraigie 15 Sep, 2024

Hi Max,

Using the demo contact form as a basis.

Is there a way to get the document root as a variable so that it doesn't have to be hardcoded in the filename when trying to attach a file to an email?

In PHP this would be $_SERVER['DOCUMENT_ROOT']

So it is possible to access this in Chronoforms?

The attachment filename could then be written something like:

{$_SERVER['DOCUMENT_ROOT']}/some_file_name_here

Thanks!

Max_admin Max_admin 27 Sep, 2024
Answer

you can use {path:front} to the get the path to the Chronoforms folder: joomla/components/com_chronoforms8/

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.