Pass filename from upload through multiple pages

pass an uploaded filename through a multi-page form.

Overview

The file information was not persisting because the Multi-page action was running before the File Upload action, clearing the data.
Move the Multi-page action to run after the File Upload action in the form events to ensure the file path is available for later use.

Answered
Da 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
Gr 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
Da 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.