core
core copied to clipboard
Files are "lost" in multi-page forms
Hi! We have been trying to configure multi-page forms through the API.
Our form is very simple, it has only two pages. In the first one, the user fills personal data and upload files. In the second page, the user reviews the information and click a Send button.
When configuring multi-page forms through the FormTools Admin Panel, we have noticed that the file upload fields do not appear after submitting the test submission.
Here you have a few PHP snippets that may be helpful:
Page 1: Filling information
<?php
require_once("formtools/global/api/API.class.php");
$api = new FormTools\API();
$fields = $api->initFormPage(5, "initialize");
$params = array(
"submit_button" => "siguiente",
"next_page" => "nextPage.php",
"form_data" => $_POST,
"file_data" => $_FILES,
"has_captcha" => true
);
$api->processFormSubmission($params);
?>
Page 2: Review page
<?php
require_once("formtools/global/api/API.class.php");
$api = new FormTools\API();
$fields = $api->initFormPage();
$params = array(
"submit_button" => "enviar",
"next_page" => "gracias.php",
"form_data" => $_POST,
"file_data" => $_FILES,
"finalize" => true,
"no_sessions_url" => "firstPage.php"
);
$api->processFormSubmission($params);
?>
Could you give us further assistance?
Thanks!
Please notice that if we set up the form as a single page form in FormTools Admin Panel, we can submit all the files without issues.
If we then manually change PHP code to switch to a multipage form (that's changing the next_page and finalize parameters), the form still works (we can submit all the text and file fields).
Thank you for your assistance.