从名称文件php多个会话

i have code to save multiple name file in session,

php code

  <?php 
         session_start();

     $_SESSION['filest'] = array();

    if (isset($_FILES)) { 
    $total = count($_FILES['file']['name']);
    $file_uploaded = $_FILES['file']['name'];
       for($i=0; $i<$total; $i++) {

    $_SESSION['filest'][] = $_FILES['file']['name'][$i];
      }  } 

     var_dump($_SESSION['filest']);
     ?>

form code

<form id="htmlForm" action="" method="post" enctype="multipart/form-data"> 
    Message: <input id="fileuploads" type="file" name="file[]" value="Hello HTML" multiple> 
    <input type="submit" value="Echo as HTML" /> 
</form>

my problem, can't get session arry. when upload more file session not saved

Try this.

I have tried your code and it's work for me.

Form.php

<form id="htmlForm" action="test.php" method="post" enctype="multipart/form-data"> 
    Message: <input id="fileuploads" type="file" name="file[]" value="Hello HTML" multiple> 
    <input type="submit" value="Echo as HTML" /> 
</form>

test.php

$session_array = array();
if (isset($_FILES)) {
    $total = count($_FILES['file']['name']);
    $file_uploaded = $_FILES['file']['name'];
    for ($i = 0; $i < $total; $i++) {
        $session_array[] = $_FILES['file']['name'][$i];
    }
}
$_SESSION['filest'] = $session_array;
var_dump($_SESSION['filest']);

To use the $_SESSION variable, you have to use session_start() at the top of every page.

You have to add session_start(); function at beginning of all pages...