You can try this,
$info = pathinfo($_FILES['userFile']['name']);
$ext = $info['extension']; // get the extension of the file
$newname = "newname.".$ext;
$target="images/".$newname;
move_uploaded_file( $_FILES['userFile']['tmp_name'], $target);
You can try this,
$info = pathinfo($_FILES['userFile']['name']);
$ext = $info['extension']; // get the extension of the file
$newname = "newname.".$ext;
$target="images/".$newname;
move_uploaded_file( $_FILES['userFile']['tmp_name'], $target);