0

Hi,

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

1.php

<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" />
</form>

2.php

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" />
</form>

3.php

//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>';

Edited by veledrom: .

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by veledrom
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.