graham23s Posted June 20, 2007 Share Posted June 20, 2007 Hi Guys, when a user uploads a photo i do the inevitable file validating, but what if a user uploads 5 photos at a tim (the maximum) is there a way i can do all 5 at 1 time heres the code for 1: ## validation 1 #################################################################### if ($_FILES["headshot1"]["size"] > $max_image_size) { echo '<br /><font color="red">Error:</font> Sorry, 1 Or More Headshots Are To Big Please (<a href="javascript: history.go(-1)">Go Back</a>) Choose Another.<br /><br />'; include("includes/footer.php"); exit; } ## validation 2 #################################################################### $dim = getimagesize($_FILES["headshot1"]["tmp_name"]); if($dim[0] >= $max_image_width || $dim[1] >= $max_image_height) { echo "<p>Sorry, The Maximum Width Is: 540 And The Maximum Height Is: 400 Please <a href=\"java script: history.go(-1)\">Go Back</a> And Fix This.</p>"; include("includes/footer.php"); exit; } is it possible to validate all 5 instead of doing the above code 5 times. thanks for any info Graham Quote Link to comment https://forums.phpfreaks.com/topic/56381-file-validating/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.