Increasing the limit of "file Multiple"

Asked

Viewed 1,242 times

0

I am trying to upload multiple images and I want the file limit supported at the time of the upload to be 70 arquvios, only this limit is only 6.

I thought it was the php.ini configuration, but it’s not, because there the maximum file size is 15MB and in my test I’m trying to upload 40 images that altogether add 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 that’s 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?

  • 2

    You changed the max_file_uploads in php.ini?

  • Alternatively, if you can’t modify PHP.INI (shared servers) you can use some upload Javascript plugin that makes a new request for each file, circumventing this limitation.

  • @Laerte didn’t find anything "max_file_uploads" in php.ini

  • 1

    You can add it...

  • @Laerte, how to add?? is just paste this code to "ini_set('max_file_uploads', 70);"??

  • Glue like this: max_file_uploads = 20

  • @Laerte looks like ::: ; Maximum allowed size for uploaded files. ; http://php.net/upload-max-filesize upload_max_filesize = 15M max_file_uploads = 70

  • I edited my answer. Try to copy and paste instead of your PHP code.

  • @Van Ivan is missing a ; between upload_max_filesize = 15M and max_file_uploads = 70 (upload_max_filesize = 15M; max_file_uploads = 70;). But probably with 70 limit files you will consequently have to increase upload_max_filesize as well.

  • ";" made a difference, now it was.

  • Actually the way was to add the following line to htacess php_value max_file_uploads 70

Show 6 more comments

1 answer

1


The php.ini has a directive that limits the amount of simultaneous files in the upload. Try to change 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]);
    }
}
  • does not function, continues to upload only 6

  • 1

    Good, if you can change the file php.ini directly, then do the php.ini even.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.