I had a code to update image but it is not updating image in the folder images. Why ?????
"
if (strlen(trim($title)) > 0 && strlen(trim($body)) > 0)
{
$image = $_FILES['txtImage'];
$currentimage = $_POST['txtCurrentImage'];
$filename = $currentimage;
//checking if an image was uploaded
if (strlen($image['name']) > 0)
{
//checking if image is JPG
if ($image['type'] == "image/jpeg" || $image['type'] == "image/pjpeg")
{
$filename = $image['name'];
//uploading the file
move_uploaded_file($image['tmp_name'], "images/" . $image['name']);
//remove old image
if (strlen($currentimage) > 0)
unlink("images/" . $currentimage);
}
else
{
$message = "Only .jpg images are allowed to be uploaded";
}
}
"