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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:44:28+00:00 2026-05-14T20:44:28+00:00

Let’s say that I’m setting up an upload feature for a project. I’m using

  • 0

Let’s say that I’m setting up an upload feature for a project.
I’m using PHP5, and I was wondering if by using the $_FILES superglobal array, I could have access to the “tmp_name” array key , which is the temporary path and name of the file being uploaded to display a preview of the image, before moving it to the “uploads” folder in the server.

What I had in mind is something like this:
Use jQuery to detect when the “file” input filed changes (when the user selects an image file), then place an ajax call to upload the the file, which will move it to the temp folder even before I use “move_uploaded_file”.
If I can somehow access the “tmp_name” array key, I could probably put it into and “img” tag to display a preview.
Later move the file to it’s final location when the submit button is clicked.

I’m not asking for any code examples or anything, since I’d be thrilled to accomplish this on my own, I just want to find out if there is access to that array key in any way.

  • 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-14T20:44:29+00:00Added an answer on May 14, 2026 at 8:44 pm

    Yes, you can.

    In PHP, when a user submits a form with a the $_FILES superglobal is populated with useful information about the uploaded file. Inside you’ll find each uploaded file’s original name, content-type, temporary upload location on the server, an error code, and the size in bytes.

    Taken from Fixing the $_FILES superglobal

    Here is the example print_r output taken from the website of the $_FILES array,

    Array
     (
        [download_zip] => Array
         (
            [name] => dummy.txt
            [type] => text/plain
            [tmp_name] => /Applications/MAMP/tmp/php/php5TBPsw
            [error] => 0
            [size] => 1
         )
    
        [download_screenshot] => Array
         (
            [name] => dummy.txt
            [type] => text/plain
            [tmp_name] => /Applications/MAMP/tmp/php/phpTncd39
            [error] => 0
            [size] => 1
         ) 
    )
    

    You can access the tmp_name by using $files_array['download_zip']['tmp_name'] syntax.

    Update:

    $path = $files_array['download_zip']['tmp_name'];
    echo "<img src='$path'>"; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let me explain best with an example. Say you have node class that can
Let's say that I have a SQLite database that I create in a separate
Let's say I have window.open (without name parameter), scattered in my project and I
Let's say I have an facebook application running using the JS SDK. First user
Let's say I have multiple requirements for a password. The first is that the
Let's say that I have a date in R and it's formatted as follows.
Let's say you have a method that expects a numerical value as an argument.
Let's say I have a bunch of links that share a click event: <a
Let's say I have the string: hello world; some random text; foo; How could
Let's say that I have a set of relations that looks like this: relations

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.