URGENT - Need help attaching multiple files from Wordpress media directory

My client is asking me for a working proof of concept before we go ahead and purchase using gravity forms as a solution. I have a presentation tomorrow morning and need urgent help please to resolve one last issue I am facing.

The idea is that we are programmatically trying to attach x number of attachments to the notification object retrieved from the wordpress media library. These attachments are determined programmatically according to what selections the user specified in the form filling stage.

In GFORM_NOTIFICATION event I am attaching a single file from the Wordpress library to an email notification. My client has asked me to show a proof of concept that we can programmatically attach multiple files.

so before my working code to attach one file looked like this:

$attachment = get_attached_file($file1);
$notification [‘attachments’][] = $attachment;

my new code to attach 2 files is not working. it is only attaching one file (file2). what is wrong with this please why will it not attach multiple files to the email notification???

$notification[‘attachments’] = array();
$notification[‘attachments’][] = get_attached_file($file1);|
$notification[‘attachments’][] = get_attached_file($file2);|

© 2008 - 2019. Gravity Forms is a project by Rocketgenius Inc.