Bizarre problem with PHP file uploads limited to 20

Hi, I have an issue with a set of PHP scripts that add product details to a mySQL db and also upload photos and enter their names into the db.

The same scripts work fine for another site on the same server, and no error is generated on this site either. But for some bizarre reason it looks as if the originating form only sends through the values for the first twenty image fields (there are fifty in all).

The inputs for the 50 images are very simple:

<input name="_Pic1" type="file" />

  • and so on, with the inputs called _Pic1 to _Pic50.

The weird thing is that you can browse for each of the images you want to upload, but ONLY the first 20 (i.e inputs _Pic1 to _Pic20) are uploaded, and what’s more only the values of the first 20 are passed through to the script that enters them into the mySQL db.

No error is thrown at any point- values for inputs after Pic20 seem to be ignored. If within the db update script I add:

echo $pic20; //which relates to input _Pic20

Then it outputs the name of the file. But:

echo $pic21; //which relates to input _Pic21

Utterly blank.

The db field names are all named correctly. The first 20 pics are added correctly to fields pic1 to pic20, and they are also uploaded successfully to the site folder where they belong (subject to file size checking).

Anyone got any ideas? There are no errors reported in the scripts, the form just seems to be ignoring the file inputs after 20!!


Yup, it’s max_file_uploads

Great, thanks- I’ll see if I can get them to change it.

That’ll be why I couldn’t see where the script was going wrong!

Do you know where in php.ini they’ll need to change it, i.e what setting is this called? (They’ll probably ask me… and I don’t have access so can’t change it myself)


That’s not bizarre, it’s a php.ini setting :cool:

It’s status is PHP_INI_SYSTEM , so you should change it in php.ini or httpd.conf (Apache). If you don’t have access to those files you could ask your hoster. If your hoster doesn’t want to change it I’m afraid you’re out of luck …