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>';
Re: I need to pass full content of `$_FILES` to third page 80 80

What is the need of mediator page 2?
If you still want page 2, as diafol told you on http://www.daniweb.com/web-development/php/threads/422848/read-a-file-content-without-uploading-it-to-the-server you need to read file data first on page 2 and then use it as a hidden var and pass it to page 3.

Re: I need to pass full content of `$_FILES` to third page 80 80

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.