Skip to content
Advertisement

Ajax POST Success But No Data Are Send

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

Advertisement

Answer

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

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement