SOLVED! Used this example from php.net post method handling multiple uploads, with the knowledge gained by using andre’s answer which is why I selected it as the answer, here it goes!
foreach ($_FILES["userfile"]["error"] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
if ($x=="0"){
$data=explode(".",$_FILES["userfile"]["name"][$key]);
$named=$id[id].".".$data[1];
$x=$x+1;
}else{
$data=explode(".",$_FILES["userfile"]["name"][$key]);
$named=$id[id]."-".$x.".".$data[1];
$x=$x+1;
}
$uploaddir = '/home/content/92/8498392/html/items/'.$_POST[catid];
$tmp_name = $_FILES["userfile"]["tmp_name"][$key];
move_uploaded_file($tmp_name, "$uploaddir/$named");
}
}
The result is the first image is uploaded as 45.jpg, the second is uploaded as 45-1.jpg and so forth! Thanks for the help guys 😀
The problem is how you are iterating over the $_FILES array. It does not handle mutliple files like you think so use the functions below and incorporate them into your script. The credit for the script below goes to the guy on the PHP site. Link is below the code.
I took this from the PHP website