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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:27:19+00:00 2026-05-27T23:27:19+00:00

I have a page with the following structure: 1. Text 2. Form with SUBMIT

  • 0

I have a page with the following structure:

1. Text

2. Form with SUBMIT button that allows users to upload files

3. PHP code to handle the files

I’d like to complete 2 (wait for user to hit SUBMIT) before going to 3. I’d also like to keep the activity on the same page… right now if a user hits SUBMIT he/she is redirected to the upload.php script.

What’s the simplest way to accomplish this, given that I’m new to PHP? Thank you for your time.

Code below:

HTML (I’d like to keep everything on this page):

<html>
<body>

<form action="upload_file.php" method="post" enctype="multipart/form-data">
<br />
<label for="file">Upload Files:</label>
<br />
<br />
<input type="file" name="file1" id="file" /> 
<input type="file" name="file2" id="file" /> 
<input type="file" name="file3" id="file" /> 
<br />
<br />
<input type="submit" name="submit" value="Submit" />
</form>

</body>
</html>


 <?php




//$result = $storageClient->putBlob('testcontainer', 'example.txt', 'C:/example.txt');
// I'll be uploading each of the three uploaded files here
// Syntax: putBlob (ContainerName, NameInStorage, FileLocation)

?> 

Script:

<?php
error_reporting(E_ALL);


for ($i=1; $i<4; $i++)
    {
    $file = "file" . $i;
    if (($_FILES[$file]["size"] < 20000))
      {
      if ($_FILES[$file]["error"] > 0)
        {
        echo "Return Code: " . $_FILES[$file]["error"] . "<br />";
        }
      else
        {
        echo "Upload: " . $_FILES[$file]["name"] . "<br />";
        echo "Type: " . $_FILES[$file]["type"] . "<br />";
        echo "Size: " . ($_FILES[$file]["size"] / 1024) . " Kb<br />";
        echo "Temp file: " . $_FILES[$file]["tmp_name"] . "<br />";


        $moved = move_uploaded_file($_FILES[$file]["tmp_name"], "C:/inetpub/wwwroot/PHP_Ramp/upload/" . $_FILES[$file]["name"]);

        if ($moved) {
            echo "Move: Success <br/>";
        }
        else {
            echo "Move Failed <br/>";
        }


          echo "Stored in: " . "C:/inetpub/wwwroot/PHP_Ramp/upload/" . $_FILES[$file]["name"];
          }
        }

    else
      {
      echo "Invalid file";
      }

}
?>
  • 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-27T23:27:20+00:00Added an answer on May 27, 2026 at 11:27 pm

    You cannot achieve this using only PHP. If you want the process to be on the same page (without refresh) you need to use AJAX, which is javascript. Try reading jQuery ajax section.

    And as you’re uploading file, you cannot do a file upload using pure ajax (the xmlhttprequest object does not support file upload) so you might want to look for plugins to do this, or you can use a hidden IFRAME that your form will target.

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

Sidebar

Related Questions

I have a web page with basicly the following URL structure: www.example.com/main.php?userId=mattias.wolff www.example.com/definitions.php?userId=mattias.wolff www.example.com/tasks.php?userId=mattias.wolff
I have the following ASP page: <asp:Content ID=Content2 ContentPlaceHolderID=ShellContent runat=server> <form runat=server id=AddNewNoteForm method=post>
I have the following scenario. I have a index.php page with the following JQuery
i have following code to show div on page <div id=all_users> <div id=user11 userid=11
I have the following code in a jsp page (Struts backed): <c:if test=${USERINFO.someproperty ==
I have an XML file in the following structure. <NewDataSet> <markers> <name>name text</name> <desc>desc
I have the following tabs on certain div on my page: (this code is
I have the following structure in a Windows Form: Form (AutoResize = true, AutoSizeMode
I have a page with lots of comments. The code structure is as follows:
Lets say we have the following structure in a web page. How can i

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.