Forums

Pass filename from upload through multiple pages

Daniac 01 Nov, 2016
Hi,

In my form, I can upload a file on the first page via a file field. That works fine.
Now I would like to send this uploaded file as attachment in an email, but on the last page after the submit.

I have found that the $form->file array is only available on the page where the file was uploaded.

I tried to add a new value to $form->data array, but the entry is lost on the next page.

How is it possible to get the filename after submitting my form?

My Events:
On page3
- Multi Page
- File Upload
- Custom Code:
<?php
$form->data['attachment'] = $form->files['anhang']['path'];
?>

On submit
- Multi Page
- Custom Code:
<?php
$form->files = array('anhang' => array('path' => $form->data['attachment']));
?>
- Email
GreyHead 01 Nov, 2016
Answer
1 Likes
Hi Daniac,

Please move the Multi-page action down below the Files Upload action - otherwise the file info isn't available to carry forward.

Bob
Daniac 02 Nov, 2016
Hi GreyHead,

Thanks a lot, that has solved my problem.
This topic is locked and no more replies can be posted.