An array of PHP $ _FILE missing elements from the submitted HTML form

Basically, when I have more than 25 file uploads in one form, the PHP $ _FILES array is truncated to the first 25 entries (0-24), which is incorrect. It should have all 31. This happens on only one specific server. Apache with PHP. Ive tried this on two other servers, and they seem to allow all 31.

Could this be caused by a configuration option in Apache? Or is it rather a configuration problem in PHP?

The only thing I can think of is perhaps the apit LimitRequestFields directive, but this should cause an error, and not just trim it to the first 25. Is that correct?

I know that having a large number of fields in one form is bad practice, but this is necessary because of the functionality needed for this particular page. I can not get around this.

Any help with this issue would be greatly appreciated.

The HTML below demonstrates the problem I am facing.

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>

<form enctype="multipart/form-data" action="test.php" method="post">
<input type="file" name="field_id_11[0][1]"/>
<input type="file" name="field_id_11[1][1]"/>
<input type="file" name="field_id_11[2][1]"/>
<input type="file" name="field_id_11[3][1]"/>
<input type="file" name="field_id_11[4][1]"/>
<input type="file" name="field_id_11[5][1]"/>

<input type="file" name="field_id_11[6][1]"/>
<input type="file" name="field_id_11[7][1]"/>
<input type="file" name="field_id_11[8][1]"/>
<input type="file" name="field_id_11[9][1]"/>
<input type="file" name="field_id_11[10][1]"/>
<input type="file" name="field_id_11[11][1]"/>
<input type="file" name="field_id_11[12][1]"/>
<input type="file" name="field_id_11[13][1]"/>
<input type="file" name="field_id_11[14][1]"/>
<input type="file" name="field_id_11[15][1]"/>
<input type="file" name="field_id_11[16][1]"/>
<input type="file" name="field_id_11[17][1]"/>
<input type="file" name="field_id_11[18][1]"/>
<input type="file" name="field_id_11[19][1]"/>
<input type="file" name="field_id_11[20][1]"/>
<input type="file" name="field_id_11[21][1]"/>
<input type="file" name="field_id_11[22][1]"/>

<input type="file" name="field_id_11[23][1]"/>
<input type="file" name="field_id_11[24][1]"/>
<input type="file" name="field_id_11[25][1]"/>
<input type="file" name="field_id_11[26][1]"/>
<input type="file" name="field_id_11[27][1]"/>
<input type="file" name="field_id_11[28][1]"/>
<input type="file" name="field_id_11[29][1]"/>
<input type="file" name="field_id_11[30][1]"/>
<input type="text" name="blah" value="something"/>
<input type="submit" />
</form>

</body>
</html>
+5
source share
6 answers

The fact that "25 maximum files" and "only happens on a specific server" seems to indicate some configuration / security settings on that server.

And the "25 maximum downloads" is the standard configuration extension SUHOSIN PHP - see the suhosin.upload.max_uploadsconfiguration directive.


( ) Linux - Ubuntu , , ; , / phpinfo().

+3

" " ini.

max_file_uploads, PHP 5.2.12, , , , .

, upload_max_filesize , , , , max_file_uploads.

+1

PHP . , , PHP Apache, , 6 .

, , , . 31, PHP, 25, Apache.

0

Suhosin . upload_max_filesize post_max_size php.ini.

0

move_uploaded_file, , , ? copy move_uploaded_file ( ), ,

$file1 = $_POST['file1'];
$file2 = $_POST['file2'];
$file3 = $_POST['file3'];
$file4 = $_POST['file4'];
$file5 = $_POST['file5'];
$file6 = $_POST['file6'];
$array = array($file1,$file2,$file3,$file4,$file5,$file6);

 if(isset($_POST['submit']))
 {
  for($i=0;$i<count($array);$i++)
  {
   $dir = $array[$i];

   $uploaddir  = "dirfiles/";
   $uploadfile = $uploaddir.$_FILES['file1']['name'];
   move_uploaded_file($_FILES['file21']['tmp_name'],$uploadfile);

   $uploaddir  = "dirfiles/";
   $uploadfile = $uploaddir.$_FILES['file2']['name'];
   move_uploaded_file($_FILES['file2']['tmp_name'],$uploadfile);

           ?????????????????????????????????????????????????????
           ?????????????????????????????????????????????????????
0
source

All Articles