you may need to change in php.ini file and increase the limit of max_file_uploads
(it mustbe 5 in your server now)
Also make sure to make relevant changes to these parameters (if needed)
upload_max_filesize
post_max_size
max_input_time
max_execution_time
LevSahakyan solved the problem.
He was using
for($i=0; $i<count($_FILES['upload']); $i++)
and because 'upload' is an array itself and has 5 parameters (name, type, tmp_name, error and size) it was uploading only 5 items.
now he is using right parameter -
for($i=0; $i<count($_FILES['upload']['name']); $i++)