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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:39:56+00:00 2026-06-15T00:39:56+00:00

I have two forms on my site, one that uploads a single file, and

  • 0

I have two forms on my site, one that uploads a single file, and one that uploads multiple files. Both forms upload to the same directory and the single file form is working flawlessly. In an effort to optimize the code for the multiple file upload form so that I’m not writing out the processing of each file individually I have the following code:

foreach($_FILES['multi']['name'] as $uploaded_file){
     if(!move_uploaded_file($uploaded_file, "/var/www/uploads/".$uploaded_file."")){
         echo "Could not move File: ".$uploaded_file."<br />";
     }else{
         // Do additional processing
     }  
}

Instead of moving the files to the directory, that is valid and works for the single file upload form, the script errors out and displays my stop message:

"Could not move File: <filename here>"

Been scratching my head most of the nice, thanks in advance to any insight and help!

  • 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-15T00:39:57+00:00Added an answer on June 15, 2026 at 12:39 am

    You’re not targeting the temporary file location of the upload properly:

    foreach ($_FILES['multi']['name'] as $idx => $uploaded_file) {
        move_uploaded_file($_FILES['multi']['tmp_name'][$idx], "/var/www/uploads/$uploaded_file");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two forms, one with a radio button that users must select to
I have an upload form that uploads mp3s to my site. I have some
I have two separate web applications, both in the same intranet. One of the
I have two MVC3 sites, both hosted on the same server that I've configured
I have two forms, and so two different submit buttons, for one page (page
I have two Forms. One with where all the main code is being executed.
I have two forms on one page and want to have the input boxes
I have two forms. First one is to decide button numbers by using jslider.
I have a(n) (MDI) Windows Form application. It contains two forms. One form (Measured
Ok, this one is driving me nuts. I have a backend file uploader that

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.