0
    <form action='' method='post'>
    <input type="file" class="form-control" name="kk">
    <input type="submit" class="form-control" name="submit">
    </form>
    <?php
    if(isset($_POST['submit'])){

    echo $_FILES["kk"]["name"]; 

    }
    ?>

hi,i'm new to php,In this code undefined index kk coming on uploading file,i just want the file name...please help me out

2 Answers 2

3

add enctype="multipart/form-data" to form tag

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you verymuch
1

You need to pass enctype="multipart/form-data" when you have to upload file

<form action='' method='post' enctype="multipart/form-data">
    <input type="file" class="form-control" name="kk">
    <input type="submit" class="form-control" name="submit">
    </form>
    <?php
    if(isset($_POST['submit'])){

    echo $_FILES["kk"]["name"]; 

    }
    ?>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.