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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:26:22+00:00 2026-06-01T06:26:22+00:00

So I have 4 pages. They are very simple. index.php (WORKS) <html> <form action=upload.php

  • 0

So I have 4 pages. They are very simple.

index.php (WORKS)

<html>
<form action="upload.php" method="POST" enctype="multipart/form-data">
<input type="file" name="file"><br />
<input type="submit" value="Now upload it!">
</form>
</html>

upload.php (WORKS)

<?php
if ($_FILES["file"]["error"] > 0)
  {
  echo "Error: " . $_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 "Stored in: " . $_FILES["file"]["tmp_name"];

  echo 'Are you sure you want to continue saving this file';
  echo '<a href="yes.php">Yes, continue</a>
  <br />
  <br />
  <a href="no.php">No thanks</a>'
  }
?>

no.php (WORKS)

<?php
echo 'Thanks anyway';
?>

yes.php (ERROR)

<?php
    if ($_FILES["file"]["error"] > 0)
      {
      echo "Error: " . $_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 "Stored in: " . $_FILES["file"]["tmp_name"];

      echo 'We will now save this document:';
      //Save document code
      }
    ?>

Output of yes:

Notice: Undefined index: file in /home/public_html/test/yes.php on line 2 Invalid file

We will now save this document:?

As you can see I never save it. But I would like to save it in the yes.php page. Is it still possible to retrieve that original doc that was uploaded? Thanks in advance.

  • 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-01T06:26:23+00:00Added an answer on June 1, 2026 at 6:26 am

    Uploaded files are only available for a single PHP instance/request cycle.
    Uploaded files are stored in the temp directory. If they’re still there when the script finishes executing, PHP will delete them assuming you didn’t need them.

    If you want to persist the file, you’ll have to move it elsewhere in the same request that the file was uploaded.

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

Sidebar

Related Questions

I have a very simple file upload PHP script. I am testing with a
Suppose I have a bunch of (very simple) HTML pages, that I want to
I have a few pages and want that they use one style. See in
We have a client who desires some extremely long pages. Say 4000px plus. They
I am not very experienced with PHP. I have a site I'm maintaining that
I have built a very simple CakePHP website using the Auth component and have
I have many sub pages, there urls like www.domain.com/sub/page1.php www.domain.com/sub/page2.php ... Now when I
This is probably a very simple question. I am new to Rails and have
I have a very simple modulefile: #%Module1.0##################################################################### puts stderr Loading personal environment proc ModulesHelp
I'm trying to do something which should be very simple...I have a site with

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.