即使设置了tmpdir,php文件上传返回错误6

php file upload returning error 6 even though tmpdir is set in php.ini and all paths are correct. My code is too long to be posted but here's the part where it handles the file

$uploaddir = __DIR__ . '/img/';

        echo $_FILES['navpic']['error'];

        if($_FILES['navpic']['size'] != 0) {
            $navpic = $uploaddir . "navpic.png";
            if($_FILES['navpic']['size'] < 1000000) {
                if (move_uploaded_file($_FILES['navpic']['tmp_name'], $navpic)) {
                    $navpicupload = 0;
                } else
                    $navpicupload = 1;
            } else {
                $navpicupload = 2;
            }
        } else {
            $navpicupload = 1;
        }

//edit I also have permission to write in both directories so thats neither the problem :/