Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8652389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:17:48+00:00 2026-06-12T14:17:48+00:00

I have a form which includes a file upload. Everything in the form seems

  • 0

I have a form which includes a file upload. Everything in the form seems to be working fine except that the $_FILES['file']['name'] turns up empty.

HTML

<form ... >
<input class="file" type="file" name="file[]" />
<input class="file" type="file" name="file[]" />
<input class="file" type="file" name="file[]" />
</form>

PHP

foreach ($_FILES['file']['name'] as $index => $file) {
    // Handle file upload
}

I get an error saying that the index $_FILES['file'] is not defined. I’ve checked that file upload is enabled in PHP. What else could be causing this to turn up empty?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T14:17:50+00:00Added an answer on June 12, 2026 at 2:17 pm

    Is the enctype right?

    Try

    <form action="upload_file.php" method="post" enctype="multipart/form-data">
       <input class="file" type="file" name="file[]" />
       <input class="file" type="file" name="file[]" />
       <input class="file" type="file" name="file[]" />
    </form>
    

    Without enctype no files will be uploaded, so the $_FILES array will be empty.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form which includes 3 textfields so users can upload files. They
I have a PHP form which includes a file being uploaded upon submit. As
I have a form which includes filefield to upload some files. Sometimes what happens
I have a simple input form which contains an input type=file with name=pdf_statement. I
I have a form which includes a data sheet. I would like to make
I have a simple Ruby on Rails form which includes an authenticity_token. Unfortunatly, I
Hi I have a visual studio project which includes postbuildevents in the following form:
i have an form which will send some data to an php file ,
I have a form in a jsp file, which I have used to get
I'm creating a Zend Form which includes a Zend Form Element File to allow

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.