Hi -
Posted earlier, but still having some probs.
Trying to upload multiple images via my getImage function (see below).
the form contains e.g.
<input type=file name=Image>
<input type=file name=Image2>
then calling
getImage($Image);
getImage($Image2);
does not upload. Here's my function presently. Please yell at me when you find the stupid mistake. But do please explain why this is not working, because I'm fairly new at all this. Many thanks to all who take the time...
function getImage($img) {
global $img, $img_name, $img_type, $img_size;
if (!empty($img_name)) {
if ($img_type == "image/jpeg" or $img_type == "image/pjpeg" or $img_type == "image/gif") {
if ("image/gif" == $img_type) {
$ext = ".gif";
}
else {
$ext = ".jpg";
}
$imagepath = $server_path . "/gfx/articles/" . date("Ymd") . "." . time() . $type . $ext;
if (copy($img, $imagepath)) {
unlink($img);
if ($img_name == "ImageUpload") {
$Image = "/gfx/articles/" . date("Ymd") . "." . time() . $ext;
}
elseif ($img_name == "ImageUpload2") {
$Image2 = "/gfx/articles/" . date("Ymd") . "." . time() . "-2" . $ext;
}
elseif ($img_name == "ThumbImageUpload") {
$ThumbImage = "/gfx/articles/" . date("Ymd") . "." . time() . "-t" . $ext;
}
echo("success");
}
else {
echo("failure");
}
}
else {
echo("Not a GIF or JPEG.");
}
}
}