Skip to content Skip to sidebar Skip to footer

Upload Multiple Files To Server And

My first post so be gentle! I've tried searching for this and there are many similar posts, but I can't seem to find anything exactly like my problem and I have been at this for ho

Solution 1:

foreach ($_FILESas$inputName => $uploadedFile) {
    echo$inputName, ':', PHP_EOL;
    print_r($uploadedFile);
}

Output

file1:
Array (
    'name' => ...
    'tmp_name' => ...
    ...
)
file2:
Array (
    'name' => ...
    'tmp_name' => ...
    ...
)

Solution 2:

The name of the file INPUT should be a key of the row in the $_FILES array. For example, in your example the $_FILES array should have two rows that can be referenced like so: $_FILES['file1'] and $_FILES['file2']. So when you are looping through the array just look up that key value and insert it in the row.

Solution 3:

Easiest not to have different names for inputs but same names written as arrays, for example name="file[]".

Solution 4:

I believe the question has been answered, but for future suggestion, if you need more info on the passing parameters in CI, you can use Xdebug (i use in tandem with Netbeans). I just use it for a week and it's such a great tool to have!

Post a Comment for "Upload Multiple Files To Server And"