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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T13:51:40+00:00 2026-05-21T13:51:40+00:00

I’m building a page that allows files to be uploaded to the server, and

  • 0

I’m building a page that allows files to be uploaded to the server, and sorted. I know this code, even if it was working, isn’t fit to be live, it was just a first draft to get the mechanics working since I’m quite new to server-side scripting.

Anyway, here’s the upload-form page:

<html>
<body>
<?php include("header.php"); ?>
<center>
<h1>Please enter the details of the file you would like to upload:</h1><br/> 


    <table> 
    <tr>
    <td align='center'> 
    <form action='uploader.php' method='POST' enctype='multipart/form-data'><b>Name:</b> </td> 
    <td align='left'><input type='text' name='name' maxlength='255' />
    </td>
    </tr> 

    <tr>
    <td align='center'><b>Description of file uploaded: </b>
    </td> 
    <td align='left'><textarea name='description' rows='5' cols='20'></textarea>
    </td>
    </tr> 

    <tr>
    <td align='center'><b>Category: </b>
    </td> 

    <td align='left'> 
    <select name='category'> 
    <option value='1'>Agriculture</option>
    <option value='2'>Sexual Health</option>
    <option value='3'>Arithmetic</option>
    <option value='4'>Technology</option>
    <option value='5'>Reading/Literature</option>
    <option value='6'>Health/Medicine</option>
    </td>
    </tr>

    <tr>
    <td align ='center' >
    <b>File: </b>
    </td>
    <td align='left'>
    <input type="hidden" name="MAX_FILE_SIZE" value="100000" />
    <Choose a file to upload: <input name="uploadedfile" type="file" /><br />
    </td>
    </tr>

    <tr height='20px'></tr> 

    <tr align ='left'>
    <td> </td>
    <td>
    <input type='Submit' value='Upload File' /> 
    </td>
    </tr>
    </table> 

</center>

<?php include("footer.php"); ?>
</body>
</html>

and here’s the action page uploader.php:

<?php

$target_path = "./audio/";

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 

if(move_uploaded_file( $_FILES['uploadedfile']['tmp_name'], $target_path) )  {
    echo "The file " .  basename( $_FILES['uploadedfile']['name']) . " has been uploaded";
} else{
    echo "There was an error uploading the file, please try again!";
}

?>

Whenever I try to test this, on my localhost ( using XAMPP ) It echos “There was an error uploading the file, please try again!”

And every few times it also says: ”
Notice: Undefined index: uploadedfile in C:\Users\Paul\Desktop\XAMPP\htdocs\xampp\uploader.php on line 5 “

But I can’t see what’s wrong with that argument? isn’t uploadedfile defined as the temporary name for the file in my form?

Can you tell me what I’ve done wrong here?

Thanks a lot for

  • 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-21T13:51:41+00:00Added an answer on May 21, 2026 at 1:51 pm

    The problem is: your HTML is invalid, causing the form element being closed prematurely.

    There’s no </form> end tag, so it’s inserted at the next appropriate point, i.e.

    <td align='center'>
      <form action='uploader.php' method='POST' enctype='multipart/form-data'>
        <b>Name:</b>
      </form> <!-- <- here -->
    </td> 
    

    Doing so, the file input element with name uploadedfile is outside of the form and never gets send to uploader.php. To correct this issue, move the start tag outside of your table, add the end tag near the end of body and remove the < before Choose a file ….

    There are a couple of other validating errors, but I’ll leave it to you to repair those. Next time, please serve your HTML to W3C’s validator (you can do this automatically using Chris Pederick’s Web Developer toolbar) and/or look at Firebug’s/Chrome’s web inspector and look at the form element (and what it contains).

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Does anyone know how can I replace this 2 symbol below from the string
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
Basically, what I'm trying to create is a page of div tags, each has

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.