0

I have problem to upload multi file using ajax, in this case im using codeingiter, when I call $_POST array return null on upload function, this is my my form I'm using this snippets

Form

https://jsfiddle.net/alexjamesbrown/2nzL9f7g/

Server Test

public function test_upload() { echo "<pre>"; print_r ($_POST); echo "</pre>"; } 

Return

Array ( ) 

My question is how to fix this ? Thanks in advance

2
  • instead of $_POST use $_FILES to access the file input Commented Aug 15, 2018 at 6:20
  • @pradeep yes its work....thanks , but how to show or call the multiple file send in $_FILES Commented Aug 15, 2018 at 6:29

1 Answer 1

1

Try with $_FILES

public function test_upload() { echo "<pre>"; print_r ($_FILES); echo "</pre>"; } 

Your input file must have name array for multiple files like this :

<input type="file" name="files[]" multiple /> 

for more :http://php.net/manual/en/reserved.variables.files.php

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

3 Comments

Works, thanks for help, but files only one in pre tag..how to get all sending data ?
use name as an array like this name="files[]" for multiple file, see my updated answer
by the way if my answer helps you pls don't hesitate to check it as green and do upvote also

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.