Rishi
Rishi

Reputation: 15

Cannot upload file through HTML form

I am planning to make a form which has a form through which users can upload a file on the website. I used a CSS template where a class called pop-up-wrapper and pop up is defined. However, when I use the following code :

<div>
    <div class="form-pop-up">
        <div class="form-pop-up-wrapper">
            <ul class="contact-form">
                <form id="form-submit" method="post" enctype="multipart/form-data">

                    <li>
                        <p class="iam-white center-al">Upload file</p>
                        <input  type="file" name="resume" id="user-resume">
                    </li>

                    <li>
                        <p>&nbsp;</p>
                        <input type="submit" name="submit" value="Submit" id="form-submit" class="mar">
                    </li>

                </form>
            </ul>
        </div>
    </div>
</div>

I have a PHP code which validates if any file has been entered by checking with

isset($_FILES['file']

but this always returns 0. Is there anything in the CSS stylesheet which can lead to this situation where $_FILES is unable to catch the uploaded file?

TIA

Upvotes: 0

Views: 81

Answers (2)

Kenton de Jong
Kenton de Jong

Reputation: 995

Just a shot here, but I don't think it's your CSS that's causing the problem. Try:

isset($_FILES['resume'])

instead.

Upvotes: 0

Maarkoize
Maarkoize

Reputation: 2621

You have to use the name in $_FILES, not the type.

isset($_FILES['resume'])

Upvotes: 1

Related Questions