I've got a file that is not functioning quite right, and I'm having trouble seeing what I did wrong.
Essentially what's happening, is when you go to upload a file such as "image.jpg", it's being renamed as "image-jpg", which essentially makes it useless.
This is the code as of right now.
Code:
foreach ($_FILES["image"]["error"] as $key => $error)
{
if ($error == UPLOAD_ERR_OK)
{
$tmp_name = $_FILES["image"]["tmp_name"][$key];
$name = $_FILES["image"]["name"][$key];
$name = preg_replace("/([^a-z0-9])+/i", "-", $name);
move_uploaded_file($tmp_name, "../photo/$name");
chmod("../photo/$name", 0777);
echo "Image Uploaded";
$IMAGE[] = $name;
}
}
|