On my Magento 2 site I created a form that adds products to the cart programmatically using a custom module. In my custom module I created the execute function for my form action in the product page. In this function I add the products to the cart and redirect the checkout. Other than that I am trying to transfer the files, which I upload to the product page, to the checkout page (which is the redirect of my function). In summary what I would like to do is:
- I send the form from the product page
- With the execute function, which is called in the form action, I want to get the files I loaded from the input file tag
- I transfer these uploaded files to the checkout page, which is the final redirect of my execute () function
- I would like the value of my input file to be stored, on the checkout page, on another input file tag
this is my code:
Page 1 (Product Page)
<form action="myFunctionExecute()" method="post">
<input type="file" id="file" name="file" />
<input type="submit" value="send" />
</form>
Page of function
public function myFunctionExecute(){
$_SESSION['file'] = $_FILES['logoUp']['name'];
return $resultRedirect->setPath('checkout');
}
Page 2 (Checkout Page)
//IN THIS INPUT I WANT TO TRANSFER AND KEEP VALUE OF INPUT FILE FROM PAGE 1
<input type="file" name="file"/>
Is it possible to transfer the value of an input file tag and take it to another input file tag of another page? Thanks!