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

  • Home
  • SEARCH
  • 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 7637113

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:51:34+00:00 2026-05-31T07:51:34+00:00

Do $_FILES[file_name][tmp_name]; get destroyed if the user goes to another php page? I am

  • 0

Do $_FILES["file_name"]["tmp_name"]; get destroyed if the user goes to another php page?

I am trying to pass the tmp_name in a hidden form field to the actual submit function where the tmp_name is copied to the server.

So this is my flow:
User Submits forms -> User confirms submission (all $_POST are added to hidden fields) -> Once confirmed the data is submitted and the file is copy() to server

  • 0 0 Answers
  • 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-31T07:51:35+00:00Added an answer on May 31, 2026 at 7:51 am

    File uploads work like this:

    • user submits form, uploading file to server
    • PHP stores received file data in /tmp directory, putting the file name into the $_FILES array of the script
    • PHP executes your script, you do with the data whatever you want
    • when your script is done, PHP will clean up the uploaded file data from the /tmp directory if it still exists there

    So yes, uploaded files are only available for a single script execution. If you need them later, move them to a more permanent location.

    And do not pass that file location to the user, even through hidden form fields. That’s client-side data, which means the user can manipulate the data and possibly cause security breaches by pointing the file path somewhere he has no business.

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

Sidebar

Related Questions

I have this script <?php if (!empty($_FILES)) { $tempFile = $_FILES['Filedata']['tmp_name']; $targetPath = dirname(__FILE__)
I am trying to create a simple php image uploading form. I appear to
When I call unlink like so: unlink($_FILES['upload_file']['tmp_name']); I get the following error message: unlink():
I get the following error when trying to upload a .JPG file. Warning: getimagesize()
I'm looking for some help with PHP File Upload. I'm trying to upload an
I have a form to upload image like below <form name=sample enctype=multipart/form-data action=index.php method=post
I have the following $name = basename($_FILES['the_file']['name']); $size = $_FILES['the_file']['size']; $contents = $_FILES['the_file']['tmp_name']; if($size
I'm using a simple form to upload 5 files: <form enctype=multipart/form-data action=openaccount.php method=post> <h4>Proof
i am trying to transfer file from user to my server and than upload
i get the following errors ( ! ) Notice: Undefined index: file in C:\wamp\www\upload_file.php

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.