$filename = $_FILES['image']['name'];
function uploadFiles($filename){
$ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
$filetmp = $_FILES['avatar']['tmp_name'];
..........
..........
$target = $path.basename($filename);
$upload = move_uploaded_file($filetmp,$target);
if(!$upload){
$errors[] = 2;
}
}