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

  • SEARCH
  • Home
  • 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 8965223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:45:59+00:00 2026-06-15T16:45:59+00:00

I have more than one input which are of type file <form name=vform method=post

  • 0

I have more than one input which are of type file

<form  name="vform" method="post" enctype="multipart/form-data" >
  <input type=file name='thumbs1' />
  <input type=file name='thumbs2' />
  <input type=file name='thumbs3' />
  ... etc
</form>

let say i got the count of file input=3

$i = 1;
while($i <= 3)
{
   $thumb = "thumbs".$i;
   $fileName = $_FILES['$thumb']['name'];
   $tmpName  = $_FILES['$thumb']['tmp_name']; 
   $filePath = "directory/";

   if(move_uploaded_file($tmpName, $filePath)){echo " ";}else{echo " ";}

   $i++;
}

What happens here is that only the first one got the filename, but not one of them move to the expected directory or anywhere else.

Is there a specific way to declare when dealing with multiple file input?

  • 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-15T16:46:00+00:00Added an answer on June 15, 2026 at 4:46 pm

    Remove the single quotes from $_FILES['$thumb'] and change it to $_FILES[$thumb]

    PHP will not parse variables within the single quotes ' '.

    On move_uploaded_file function you need to specify the file name for destination before moving

    $i = 1;
    while($i <= 3)
    {
       $thumb = "thumbs".$i;
       $fileName = $_FILES[$thumb]['name'];
       $tmpName  = $_FILES[$thumb]['tmp_name']; 
       $filePath = "directory/";
    
       if(move_uploaded_file($tmpName, $filePath.$fileName)){echo " ";}else{echo " ";}
    
       $i++;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically when I have more than about 25 file uploads in one form, the
I have a page with more than one form. One form (see below example)
I have done fastload for table which has more than one column (I did
I have a page which may has about more than 1 form like below.
I have more than one Event Listener that calls a specific function, and I
Where I have more than one table in my database for use with (similar,
I would like to have more than one button. I tried to copy code
Can an if statement have more than one then statements? # this works a
Can I have more than one XmlElement on property of a class? For example:
Is it possible to have more than one application running on the iphone accessing

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.