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 931877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:34:27+00:00 2026-05-15T20:34:27+00:00

Here is the code I have, and I’m wondering what I’m doing wrong that

  • 0

Here is the code I have, and I’m wondering what I’m doing wrong that it doesn’t display the name.

<form action = "self.php" method="post" enctype="multipart/form-data">
<input type="file" name="imageURL[]" id="imageURL" multiple="" />
<input type="submit" value="submit" name="submit" />
</form>

And the processing info that isn’t working:

foreach ($_FILES['imageURL'] as $files[]) { 
    echo $files['file'];
}

Edit:

When changing my foreach loop to:

foreach ($_FILES['imageURL'] as $file) { 
    echo $file['name'];
}

Still nothing prints out.

However, when I do something like this:

foreach ($_FILES['imageURL']['name'] as $filename) { 
    echo $filename;
}

The filename does print. I don’t know what that implies though.

SOLVED UPDATE:

As linked to by John Conde, the array interlace structure is different when uploading multiple files than when uploading a single file. To use foreach, we must restructure the array.

$files=array();
$fdata=$_FILES['imageURL'];
if(is_array($fdata['name'])){
for($i=0;$i<count($fdata['name']);++$i){
        $files[]=array(
    'name'    =>$fdata['name'][$i],
    'type'  => $fdata['type'][$i],
    'tmp_name'=>$fdata['tmp_name'][$i],
    'error' => $fdata['error'][$i], 
    'size'  => $fdata['size'][$i]  
    );
    }
}else $files[]=$fdata;

NOW we can use foreach to loop:

foreach ($files as $file) { 
    echo $file['name'];
}
  • 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-05-15T20:34:28+00:00Added an answer on May 15, 2026 at 8:34 pm

    Try

    foreach ($_FILES['imageURL'] as $file) { 
        echo $file['name'];
    }
    

    UPDATE:

    Google found this tutorial which may help you

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

Sidebar

Ask A Question

Stats

  • Questions 490k
  • Answers 490k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer A couple things going on here: There's no route defined… May 16, 2026 at 9:09 am
  • Editorial Team
    Editorial Team added an answer This code should do what you want - at the… May 16, 2026 at 9:09 am
  • Editorial Team
    Editorial Team added an answer UPDATE: Silverlight 4 Service Release to fix Memory Leaks: http://timheuer.com/blog/archive/2010/09/01/silverlight-service-release-september-2010-gdr1.aspx… May 16, 2026 at 9:09 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have code here proc checkPrime {no} { set i 1 set count 0
Here is the snapshot of repeater code. I have problems with geting all the
I have several sections of code that I need to protect with a Mutex.
Ok, I have code that is working (posted after this) but before I expand
i have code use googleseach API I want to use Thread to improve speed
In my code I have effectively the following: wchar_t* buffer = new wchar_t[size]; //
I have the following code regarding asynchronous sockets programming: public void ServerBeginAceept(ushort ServerPort) {
I have following code: public class readSensorsData extends Activity implements SensorListener { /** Called
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has

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.