2

サイトの画像アップロードを構築しようとしていますが、次のようなものしかありませんが、何も出力されませんが、ページは正常にレンダリングされますか? どこが間違っているのかわかる人はいますか?\

    //if they DID upload a file...
if($_FILES['profile_image']['name'])
{
    //if no errors...
    if(!$_FILES['profile_image']['error'])
    {
        //now is the time to modify the future file name and validate the file
        $new_file_name = strtolower($_FILES['profile_image']['tmp_name']); //rename file
        if($_FILES['profile_image']['size'] > (1024000)) //can't be larger than 1 MB
        {
            $valid_file = false;
            $message = 'Oops!  Your file\'s size is to large.';
        }

        //if the file has passed the test
        if($valid_file)
        {
            //move it to where we want it to be
            move_uploaded_file($_FILES['profile_image']['tmp_name'], 'uploads/'.$new_file_name);
            $message = 'Congratulations!  Your file was accepted.';
        }
    }
    //if there is an error...
    else
    {
        //set that to be the returned message
        $message = 'Ooops!  Your upload triggered the following error:  '.$_FILES['profile_image']['error'];
    }
}

else {
echo    'success';
    }

<form method="post" action="./process-signup.php" enctype="multipart/form-data" >


    <input type="file" class="profile_image text-input" name="profile_image" placeholder="Upload a picture"/><br />
    <input type="submit" id="signup-com-btn" value="Complete Signup" />

</form>
4

1 に答える 1