-1

I have this input

<form action="<?=isset($_GET['tree'])?'edit.php':'save.php'?>" method="post" enctype="multipart/form-data" id="<?=isset($_GET['tree'])?'edit-form':'csv-form'?>">
 ....
 .....
<input type="file" name="doc" id="doc" multiple>

I'm trying to handle the uploaded files but with

var_dump($_FILES);

$_FILES only contains the last selected file.

2
  • 2
    <input type="file" name="doc[]" > <input type="file" name="doc[]" > ... Commented Sep 5, 2017 at 11:31
  • You need to define your input names as an array (see comment above) Commented Sep 5, 2017 at 11:33

2 Answers 2

1

use the name tag with square brackets: <input type="file" name="doc[]" id="doc" multiple>

Sign up to request clarification or add additional context in comments.

Comments

0

Use like this.

<input type="file" id="doc" name="doc[]" multiple>

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.