i am new to web development. As i go through some tutorial, i found that i was not able to upload a file to my server using php. Below shows whats is in my htdocs directory in apache2.
./index.php
./upload_action.php
./uploads
index.html
    1 <html>
    2     <head>
    3     </head>
    4     <body>
    5         <h1>New Model</h1>
    6 
    7         <h2>Model information</h2>
    8         <form enctype="multipart/form-data" action="./upload_action.php" 
              method="POST">
    9         <p> Name:
   10         <input type="text" name="textline" >
   11         </P>
   12 
   13         <p> Model to upload:
   14         <input type="file" multiple name="file to upload" 
               value="fileupload" id="fileupload">
   15         </P>
   16         <br>
   17         <input type="reset" value="reset">
   18         <input type="submit" value="submit">
   19         </form>
   20 
   21 
   22     </body>
   23 
   24 </html>
upload_action.php
 1 <?php
  2 $uploaddir = "/uploads/";
  3 $uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
  4 
  5 echo '<pre>';
  6 if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
  7         echo "Success.\n";
  8 } else {
  9         echo "Failure.\n";
 10 }
 11 
 12 echo 'Here is some more debugging info:';
 13 print_r($_FILES);
 14 print "</pre>";
 15 ?> 
Error msg:
Failure.
Here is some more debugging info:Array
(
    [file_to_upload] => Array
        (
            [name] => test.pdf
            [type] => application/pdf
            [tmp_name] => /tmp/phpz2qaQV
            [error] => 0
            [size] => 513536
        )
)
 
    