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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:51:41+00:00 2026-05-27T19:51:41+00:00

I am following a step by step guide on W3schools website on how to

  • 0

I am following a step by step guide on W3schools website on how to upload a file. The only thing I don’t understand is where does the php code go because if I try to put them below the html then I get notices stating “file” is undefined.

Does anyone know where the php code goes? If somebody could provide a sample of the layout of the code from W3schools then it would be very helpful. I want to see what it all is supposed to look like but I keep getting notices.

Click here to view the file upload steps on the W3schools website.

Thank you

  • 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-27T19:51:42+00:00Added an answer on May 27, 2026 at 7:51 pm
    // checking if the user has sent the data to the form
    if (isset($_POST['upload_file']))
    {
      // checking if the file size doesn't exceed the maximum size
      if ($_FILES['upload_file']['size'] < 10485760)
      {
        // checking if the user selected a file or thera are errors
        if ($_FILES['upload_file']['error'] == UPLOAD_ERR_OK)
        {
          // checking if the file type is allowed or not
          if ($_FILES['upload_file']['type'] == 'image/jpeg' || $_FILES['upload_file']['type'] == 'image/gif' || $_FILES['upload_file']['type'] == 'image/png')
          {
            $file_name = date("Hisu");
    
            if ($_FILES['upload_file']['type']=='image/jpeg')
              $file_name    = $file_name.".jpg";
            if ($_FILES['new_picture']['type']=='image/gif')
              $file_name    = $file_name.".gif";
            if ($_FILES['new_picture']['type']=='image/png')
              $file_name    = $file_name.".png";
    
            move_uploaded_file($_FILES['upload_file']['tmp_name'], 'objects/upload/files/'.$file_name);
    
            $URL_file   = 'objects/upload/files/'.$file_name;
    
            mysql_query("INSERT INTO uploads (URL) VALUES (".$URL_file.")"); 
          }
        }
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am following a step by step guide to mastering drag and drop and
Why does the following step pass: page.has_css?(doesnt exist) when this correctly fails: page.should have_css(doesnt
If I step through the following code the call to ReturnOne() is skipped. static
I'm following the step by step guide here and I hit an error at
I am following this guide On step 2 the clone/checkout just stops with no
I am following this guide to installing and using MSpec, but at the step
I'm using the following step by step guide to connect to Facebook Connect: http://msdn.microsoft.com/en-us/windows/ee702803.aspx
I have been following this guide , which goes over adding a file to
I have the following step: Then I should see an error message with identical
For strongly-typed & type-safe solution, I have to do the following step. Create some

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.