move_uploaded_file返回错误代码0,但文件没有上传到我的目录中?

I'm working on a project using codeigniter 3.0.6 and I need to upload image in some modules. the problem is that move_uploaded_file returns error code 0 but the file is nowhere to be found. I'm currently running this code on my localhost. if only it returns an error code then I can do something.. can anyone help me with this?

I've read Move_uploaded_file() function is not working too and my code below is based on one of the supposedly "working example" answer.. but still not working (error code 0 but file not found in directory). the mkdir($uploaddir, 0777, true); part doesn't seem to help.

this is my view file (display.php) :

<html>
    <head>
        <meta charset="utf-8">
    </head>
    <body>
        <form enctype="multipart/form-data" action="submit" method="POST">
            <input type="hidden" name="MAX_FILE_SIZE" value="51200000" />
            Send this file: <input name="userfile" type="file" />
            <input type="submit" value="Send File" />
        </form>     
    </body>
</html>

and this is my controller file (test.php) :

function display()
{
    $this->load->view('display');
}

function submit() {
    $uploaddir = '/assets/img/guide/';
    $uploadfile = $uploaddir . basename($_FILES['userfile']['name']);

    if (!file_exists($uploaddir)) {
        mkdir($uploaddir, 0777, true);
    } 

    echo "<p>";
    if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
        echo "File is valid, and was successfully uploaded.
";
    } else {
        echo "Upload failed";
    }
    echo "</p>";

    echo '<pre>';
    echo 'Error code:';
    print_r($_FILES['userfile']['error']);
    print "</pre>";     

    echo '<pre>';
    echo 'Here is some more debugging info:';
    print_r($_FILES);
    print "</pre>";     

    echo $this->load->view('display', $this->data);
}

and this is the result after I submit the form:

File is valid, and was successfully uploaded.

Error code:0

Here is some more debugging info:Array ( [userfile] => Array ( [name] => Hydrangeas.jpg [type] => image/jpeg [tmp_name] => C:\xampp\tmp\php46FD.tmp [error] => 0 [size] => 595284 )

)

it turns out the files WERE uploaded but instead of going to my project's base folder (D:/myproject/dev/), the files were uploaded to the harddrive folder (D:/) so i guess the mistery's solved. I just need to figure out how to direct the target folder for upload.. maybe I'll put it in another question post.

thank you all