I have updated my script to upload four files. The script runs trough without any errors but no files are uploaded. Im posting the script here to see if an error can be seen.
$UploadImageSize = "50"; // Max File size allowed in uploading image for ads -- in KiloBye(s)
$UploadImageHeight = "150"; // Max Height Allowed in uploading image for ads -- in Pixel(s)
$UploadImagewidth = "225"; // Max Width Allowed in uploading image for ads -- in Pixel(s)
$UploadPath = './images/div-storyimages/'.$_FILES['picture'.$i]['name']; // The path to uploaded image ads
$UploadImageType[0] = "gif";
$UploadImageType[1] = "jpeg";
$UploadImageType[2] = "jpg";
$UploadImageType[3] = "JPG";
for($i = 1; isset($_FILES['picture'.$i]); $i++) {
if (($_FILES['picture'.$i]['name'] != "") && ($_FILES['picture'.$i]['name'] != "none")) {
if ($_FILES['picture'.$i]['size'] > ($UploadImageSize * 1024)) {
$errorImageSize = 1;
} else {
${'picture'.$i} = $_FILES['picture'.$i]['tmp_name'];
$imgsize = getimagesize(${'picture'.$i});
$imgwidth = $imgsize[0];
$imgheight = $imgsize[1];
}
if (($imgwidth > $UploadImagewidth) || ($imgheight > $UploadImageHeight)) {
$errorImageDimension = 1;
}
$imagetype = basename($_FILES['picture'.$i]['type']);
if (!in_array($imagetype,$UploadImageType)) {
$errorImageType = 1;
}
}
if ($errorImageSize || $errorImageDimension || $errorImageType) {
include ("header.php");
GraphicAdmin();
OpenTable();
echo "<CENTER><FONT CLASS=\"title\">Division Story Error</font></center><BR>";
echo "<CENTER>";
if ($errorImageSize) {
echo "Max image size you are allowed to upload is $UploadImageSize kilobytes.<BR>Please resize your image.<br>";
}
if ($errorImageDimension) {
echo "Max image dimensions allowed is $UploadImageHeight x $UploadImagewidth pixels.<BR>Please resize your image.<br>";
}
if ($errorImageType) {
echo "<BR>Allowed image types are: ";
for ($t = 0;$t<= sizeof($UploadImageType)-1;$t++) {
echo ".".$UploadImageType[$t]."";
if ($j != sizeof($UploadImageType)-1) {
echo ", ";
}
$j++;
}
echo ".<BR>Please resave your image as an acceptable format.<br>";
}
CloseTable();
include("footer.php");
} else {
move_uploaded_file($_FILES['picture'.$i]['tmp_name'], $UploadPath);
if ($i == "1") {
$db->sql_query("insert into ".$prefix."_tourn_stories (story_id, div_id, story_content, story_image1, story_image2, story_image2, story_image3, story_image4) values (NULL, '$div_id', '$story_content', '${'picture'.$i}', , , )");
} elseif ($i == "2") {
$db->sql_query("insert into ".$prefix."_tourn_stories (story_id, div_id, story_content, story_image1, story_image2, story_image2, story_image3, story_image4) values (NULL, '$div_id', '$story_content', , '${'picture'.$i}', , )");
} elseif ($i == "3") {
$db->sql_query("insert into ".$prefix."_tourn_stories (story_id, div_id, story_content, story_image1, story_image2, story_image2, story_image3, story_image4) values (NULL, '$div_id', '$story_content', , , '${'picture'.$i}', )");
} elseif ($i == "4") {
$db->sql_query("insert into ".$prefix."_tourn_stories (story_id, div_id, story_content, story_image1, story_image2, story_image2, story_image3, story_image4) values (NULL, '$div_id', '$story_content', , , , '${'picture'.$i}')");
Header("Location: admin.php?op=div_stories");
} else {
echo "Error: No Files were uploaded.<br>";
}
}
}
}