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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:00:51+00:00 2026-05-22T00:00:51+00:00

So I want to: upload a csv file which will contain a list of

  • 0

So I want to:

  • upload a csv file which will contain a list of student numbers, one to each line (392232, per line).

  • populate an array with the student numbers (as i already have a process in place of looking up ids from an array of student numbers and storing etc if they were to add students manually)

I have been lookin at a tutorial found here.

however I am slightly confused with this:

if(isset($_FILES['csv_file']) && is_uploaded_file($_FILES['csv_file']['tmp_name'])){...

where does he establish 'tmp_name' from?

anyway, if somebody could explain how I should be going about this I would appreciate the help.

many thanks,

EDIT: added progress of where it is not working.

if(isset($_POST['csv_submit'])){
    if(isset($_FILES['csv_file']) && is_uploaded_file($_FILES['csv_file']['tmp_name'])){



        //upload directory
        $upload_dir = "/ece70141/csv_files/";
        //create file name
        $file_path = $upload_dir . $_FILES['csv_file']['name'];

        //move uploaded file to upload dir
            // GETTING THE ERROR BELOW.
        if (!move_uploaded_file($_FILES['csv_file']['tmp_name'], $file_path)) {
            //error moving upload file
            echo "Error moving file upload";
        }

        print_r($_FILES['csv_file']);

        //delete csv file
        unlink($file_path);
    }
}
  • 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-22T00:00:53+00:00Added an answer on May 22, 2026 at 12:00 am

    $_FILES is a magic superglobal similar to $_POST. It’s an array of every file that’s been uploaded in the last request, and where that file is stored (tmp_name).

    tmp_name is basically generated by the web server to let PHP know where they’ve stored the file.

    You have the following items available to you in each element of the $_FILES array:

    1. name (Original Name of the file)
    2. type (MIME Type of the file, ie. text/plain)
    3. tmp_name (Path to the uploaded files’ temporary location)
    4. error (Error occurred when uploading, 0 when no error)
    5. size (Size of the uploaded file, in bytes)

    From what I can see in your code, this will work perfectly fine and as discussed in comments, I think the issue lies in your HTML.

    The tutorial that you linked to has an incorrect <form ..> tag definition. For file uploads, you’re required to set the enctype attribute, below is what it should look like:

    <form action="" method="post" enctype="multipart/form-data">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have put together a script which will upload a CSV file and then
I want to make sure a CSV file uploaded by one of our clients
I want to upload a CSV file and use it just for import content.
My app allows to upload csv file with some data. I want to extract
I want to upload .csv file on server while i get .csv file in
I want to upload and then process a file in a Ruby on Rails
I want to upload a list of users from my work's LDAP server to
i want to upload the sound file (.ogg) in server. But it should write
I want to upload upload up to 100 MB to 1GB file onto sharepoint
I want to upload a file to a ftp server programmatically (C++). If the

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.