PHP move_uploaded_file()不起作用,什么都不返回

I am using PHP to take a file from an input, and upload it to my server (apache running on a raspberry pi).

This is my html:

<form action="admin/upload/" method="post" enctype="multipart/form-data">
    <input type="file" name="image" accept="image/*">
    <input type="submit" value="Upload">
</form>

which takes you to the upload.php file:

$valid_file = true;

if ($_FILES['image']['name']) {
    if (!$_FILES['image']['error']) {

        $currentdir = getcwd();
        $target = $currentdir .'/' . basename($_FILES['image']['name']);
        echo $target;

        if ($_FILES['image']['size'] > (1024000)) {
            $valid_file = false;
            $message = 'Oops!  Your file\'s size is to large.';
        }

        if ($valid_file) {
            $result = move_uploaded_file($_FILES['image']['tmp_name'], $target);

            if ($result) {
                $message = 'Congratulations!  Your file was accepted.';
                echo $message;
            } else {
                echo"Failed";
            }
        } 

    } else {
        $message = 'Ooops!  Your upload triggered the following error:  '.$_FILES['image']['error'];
    }
}

echo $message;

It passes the first two if-conditions, and calculates the path to move the photo to.

The image I using is 200kb so it's not too large.

As it is a valid file, it then runs the move_uploaded_file() method, storing the result in $result. However, it returns nothing. Echoing it is blank, but isset() returns true. However, it must be false because it fails the if-condition.

In the end, no photo is uploaded and i can't figure out why?