I need to pass full content of $_FILES to third page but fail to do so. File is selected once in first page. It might look wierd but It has to work this way.

If I use session $_SESSION['csv_file'] = $_FILES; in page 2, I cannot read the content of the file in page 3.

Thanks in advance


<form action="2.php" method="POST" enctype="multipart/form-data">
   Please select CSV file : <input type="file" name="uni_file" /><br />
   <input type="submit" name="submit_button" value="Upload" />


if (! isset($_FILES['uni_file'])) { echo 'Fail'; exit; }

//Prints all nicely
echo '<pre>'; print_r($_FILES); echo '</pre>';

<form action="3.php" method="POST" enctype="multipart/form-data">
   <input type="hidden" name="hidden_csv_file_content" value="<?php echo serialize($_FILES); ?>" /><br />
   <input type="submit" name="submit_button" value="Upload" />


//Gives error: unserialize() Error at offset 5 of 9 bytes
$csv_file = unserialize($_POST['hidden_csv_file_content']);

echo '<pre>'; print_r($csv_file); echo '</pre>';

I said at the begining " It might look wierd but It has to work this way...." so no need to question why page 2 because I don't know too.

I did hidden fields too just like in my example above.