将文件从临时文件夹移动到php中的子文件夹

I am trying to move a file from the temp folder to a subfolder but its not moving it. I have looked at the other posts made but everything i try doesnt change help. - UPDATED VERSION

<?php 

if (isset($_POST['submit'])){
    include("connect.php");
}

//Get current working directory
$curdir = getcwd();
$file = "image";

$username  = $_POST['user'];
$imageName = mysql_real_escape_string($_FILES["image"]["name"]);
$imageData = mysql_real_escape_string(file_get_contents($_FILES["image"]["tmp_name"]));
$imageType = mysql_real_escape_string($_FILES["image"]["type"]);
$tmp_name  = mysql_real_escape_string($_FILES["image"]["tmp_name"]);

//check if file is an image
if(substr($imageType,0,5) == "image"){
    //check if directory exists.
    if (is_dir($file)){
        //if directory does exists
        if(move_uploaded_file($tmp_name, '$file/$imageName')){
            //
            echo "$username this is an $imageType";
        }else{
            echo "There is a problem with $tmp_name";
        }

    }else{
        //if directory doesnt exists
        mkdir($file , 0777);
        echo "$file created";
    }
}else{
    //if file is not an image
    echo "This is not an image";
}

?>