Increasing the limit of the "multiple file"

0

I'm trying to upload multiple images and I want the limit of uploaded files at upload time to be 70 frames, but that limit is only 6.

I thought it was the configuration of php.ini, but it is not, because there the maximum file size is 15MB and in my test I am trying to upload 40 images that altogether only 3MB.

This is the HTML of my form:

<form method="POST" enctype="multipart/form-data">
    <input type=file multiple name="files[]" id="files[]" />
    <input type="submit" name="logar" value="Enviar" />
</form>

And this is the script used to upload:

<?php
if(isset($_POST['logar'])) 
  {
    $files = $_FILES['files'];
    $directory = 'uploads/';

    for($i = 0, $c = count($files); $i <= $c; ++ $i) 
        {
        $upload = move_uploaded_file(
        $files['tmp_name'][$i], 
        $directory . $files['name'][$i]);
        }
  }
?>

How to increase this limit?

    
asked by anonymous 18.11.2014 / 17:12

1 answer

1

php.ini does have a directive that limits the number of simultaneous files in the upload. Try changing it:

if(isset($_POST['logar'])) {

    $files = $_FILES['files'];
    $directory = 'uploads/';

    //altera a diretiva 'max_file_uploads' do php.ini através do PHP
    ini_set('max_file_uploads', 70);

    for($i = 0, $c = count($files); $i <= $c; ++ $i) {
        $upload = move_uploaded_file(
        $files['tmp_name'][$i], 
        $directory . $files['name'][$i]);
    }
}
    
18.11.2014 / 17:15