Am using this code(shown below) 4 uploading an image.
while using this getting an error like 'there was an error moving the uploaded file"

what could be the reason for this?
Though an error occurs,am still able to upload the image successfully. ie the image is saved at tha intended loaction.


code....


if($_POST["action"] == "Upload Image")
{
unset($imagename);

if(!isset($_FILES) && isset($HTTP_POST_FILES))
$_FILES = $HTTP_POST_FILES;

if(!isset($_FILES))
$error["image_file"] = "An image was not found.";


$imagename = basename($_FILES);
//echo $imagename;

if(empty($imagename))
$error["imagename"] = "The name of the image was not found.";

if(empty($error))
{
$newimage = "images/" . $imagename;
//echo $newimage;
$result = @move_uploaded_file($_FILES, $newimage);
if(empty($result))
$error["result"] = "There was an error moving the uploaded file.";
}

}

Change this:

if(empty($result))
$error["result"] = "There was an error moving the uploaded file.";

To this:

if(!$result)
$error["result"] = "There was an error moving the uploaded file.";

The $result variable should be true if the file is moved successfully.