Hạ Tím Hạ Tím - 1 month ago 8
Apache Configuration Question

Upload multiple files: max_file_uploads is not working

I set

max_file_uploads
to value
200
in
php.ini
, restarted Apache and make an upload process with 30 input files. Below is my code:

<form method="POST" enctype="multipart/form-data">
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
... // Total quantity is 30
</form>


In my controller, I use
var_dump
to detect upload data:

echo '<pre>';
print_r($_FILES['subavatar']['error']);
echo '</pre>';
die;


And there are the results:

[error] => Array
(
[0] => 0
[1] => 4
[2] => 4
[3] => 4
[4] => 4
[5] => 4
[6] => 4
[7] => 4
[8] => 0
[9] => 4
[10] => 4
[11] => 4
[12] => 4
[13] => 4
[14] => 4
[15] => 4
[16] => 4
[17] => 4
[18] => 4
[19] => 4
)


Only 20 files received, with 2 files uploaded to temp directory.


What are my wrong? How to configuration for getting more files?

A cup of beer for any help :)

Sorry for my bad English!

FULL CODE



File
controllers/Upload.php


class Upload extends CI_Controller {
public function index() {
if ($this->input->post()) {
echo '<pre>';
print_r($_FILES['subavatar']['error']);
echo '</pre>';
die;
}
$this->load->view('upload/index');
}
}


File
views/upload/index.php


<form method="POST" enctype="multipart/form-data">
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
<input type="file" name="subavatar[]" />
</form>

Answer

the server was limiting it to 20. you can try with below things, in php.ini just find "max_file_uploads" and change its value to 100

add below line under the max_file_uploads

suhosin.upload.max_uploads=100

for example:

max_file_uploads = 100    
suhosin.upload.max_uploads=100

not much sure as it works and exact solution ,but you can try with this.