I have this validation script for a multiple file upload form and it works great until I add in the validation for the max file size. This doesn't seem to work at all. I'm at the point, I'm ready to pull my hair out and I'm willing to pay someone to help if necessary. Here's my code: if (isset($_POST['Submit'])) { $user_id = $userdata[user_id]; $number_of_file_fields = 0; $number_of_uploaded_files = 0; $moved_files = 0; $uploaded_files = array(); $max_filesize = 5242880; // Maximum filesize in BYTES (currently 5MB). $upload_directory = dirname(__file__) . '/'.$user_id.'/'; //set upload directory if (!is_dir($upload_directory)) { mkdir($upload_directory, 0777, true); } for ($i = 0; $i < count($_FILES['images']['name']); $i++) { $number_of_file_fields++; if ($_FILES['images']['name'][$i] != '') { //check if file field empty or not $number_of_uploaded_files++; if($_FILES['images']['size'][$i] > $max_filesize){ echo "<b class='red'>Max file size is 5MB.</b><br/>"; $sz = false; }else{ $sz = true;} $ext = validate_extension($_FILES['images']['name'][$i]); if (($ext == true) && ($sz == true)){ $uploaded_files[] = $_FILES['images']['name'][$i]; if (move_uploaded_file($_FILES['images']['tmp_name'][$i], $upload_directory . $_FILES['images']['name'][$i])) { $moved_files++; } }else { echo "<b class='red'>File extention error. Only .doc, .pdf, .jpg and .gif files are allowed. </b><br/>"; } } } if ($number_of_uploaded_files >= 1){ echo "Number of files submitted:<b class='red'>".$number_of_uploaded_files."</b><br/>Number of successfully uploaded files:<b class='red'>".$moved_files."</b><br/><br/>Uploaded File Name(s):<br/>" . implode('<br/>', $uploaded_files) .', '. implode('<br/>', $uploaded_file_size); } } PHP:
this can be an issue of host. check the max_upload_limit in php.ini details. it really can be a pain in ass ,as was for my case