尝试提交表单时显示未定义的索引


showing undefined index when try to submit the form

每次选择图像后点击提交按钮都会面临问题"注意:未定义的索引:C:''wamp''www''Test''testImage.php第5行的profile_picture",页面打印出未选择的文本,如果未选择图像,则必须显示该文本。索引是定义的,但为什么它是这样的,请帮助你的建议

<?php
$photo = "";
if($_SERVER['REQUEST_METHOD'] == "POST")
{
    $photo = trim(stripslashes($_POST["profile_picture"]));
    if($photo != '')
    {
        //$photo = trim(stripslashes($_POST["profile_picture"]));
        header("Location: success.php");
    }
    else{
        echo 'not selected';
    }
}
?>
<!DOCTYPE html>
<html>
    <body>
        <form name="signup_form" method="post" action="<?php $_SERVER['PHP_SELF']; ?>" enctype="multipart/form-data">
            <input type="file" class="profile_picture" id="profile_picture" name="profile_picture"> </br>
            <input type="submit" name="submit_btn" id="submit_btn" class="submit_btn" value="sign up">
        </form>             
    </body>
</html>

文件不会通过$_POST发布。

它们以$_FILES阵列发布。

参考