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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:57:54+00:00 2026-06-17T19:57:54+00:00

I have used the form below to upload multiple images to my server. <form

  • 0

I have used the form below to upload multiple images to my server.

<form name="addimageForm" id="addimageForm" method="post" action="" enctype="multipart/form-data">              
    Gallery Image: 
    <input name="image_name[]" type="file" id="image_name" multiple="true">
    <input type="submit" name="addCatImage"/>
</form>

But I am confused how I should loop through it so that I can insert multiple images in my database. I used the code below, and when I run it, even when I select a image, 4 rows are inserted in my table. I think it is inserting all of the array fields(name, size, tmp_name). How can i solve the problem?

foreach ($_FILES[image_name] as $file) {
    $access->uploadSubCatImages();
}
  • 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-17T19:57:56+00:00Added an answer on June 17, 2026 at 7:57 pm

    $_FILES is multidimensional. With the syntax that you used, the Filenames would be accessible in

    $_FILES['image_name']['name'][0] # for the first one
    $_FILES['image_name']['name'][1] # for the second one
    

    and so on.
    Here is a link for reference Uploading Multiple Files

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

Sidebar

Related Questions

I have a form to upload image like below <form name=sample enctype=multipart/form-data action=index.php method=post
I have written a login form, in this I have used, form and method
I have used Java to post information to a form before, but I have
Once I have programmed GUI with Java and have used Form Layouts. Form layout
We have used Google form, Wufoo form to try to securely capture the info
I have used hook_form_FORM_ID_alter( ) function to alter a menu_edit_menu form to add few
I have used the embedRelation() to pull another form into the sfGuard user form.
I have used the silverlight control in CRM 2011.It also published on form but
I have used Jquery UI DatePicker for the option in my form to select
I have made a custom form in a module where I have used a

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.