I have the following form:

```
 <form method="POST" name="email" action="sendemail.php" enctype="multipart/form-data">
    <table border=0 cellPadding=5 cellSpacing=10 width=100%>
        <tr>
            <td><label for='position'>Position:</label></td>
            <td><input type=text name=position class=position value="" READONLY size=35 /></td>
        </tr>
        <tr>
            <td><label for='uploaded_file'>Resume:</label></td>
            <td><input type="file" name="uploaded_file"></td>
        </tr>
        <tr>
            <td colSpan=2 align=center><input class=subbtn type="submit" value="Submit" name='submit' /></td>
        </tr>
        <tr>
            <td colSpan=2><hr /></td>
        </tr>
        <tr>
            <td colSpan=2 align=center style="padding-top: 5px;"><input type=button value="Close Window" class="close" /></td>
        </tr>
    </table>
</form>

```

and the following sendemail.php:

```
<?php

$uf = $_POST['uploaded_file'];

  $to = "myemail@yahoo.com";
  $subject = "This is subject";
  $message = "This is test message.";
  # Open a file
  $file = fopen( $uf, "r" );
 if( $file == false )
  {
     echo "Error in opening file";
     exit();
  }
  # Read the file into a variable
  $size = filesize($file);
  $content = fread( $file, $size);

  # encode the data for safe transit
  # and insert \r\n after every 76 chars.
  $encoded_content = chunk_split( base64_encode($content));

  # Get a random 32 bit number using time() as seed.
  $num = md5( time() );

  # Define the main headers.
  $header = "From:myemail@yahoo.com\r\n";
  $header .= "MIME-Version: 1.0\r\n";
  $header .= "Content-Type: multipart/mixed; ";
  $header .= "boundary=$num\r\n";
  $header .= "--$num\r\n";

  # Define the message section
  $header .= "Content-Type: text/plain\r\n";
  $header .= "Content-Transfer-Encoding:8bit\r\n\n";
  $header .= "$message\r\n";
  $header .= "--$num\r\n";

  # Define the attachment section
  $header .= "Content-Type:  multipart/mixed; ";
  $header .= "name=\"test.txt\"\r\n";
  $header .= "Content-Transfer-Encoding:base64\r\n";
  $header .= "Content-Disposition:attachment; ";
  $header .= "filename=\"test.txt\"\r\n\n";
  $header .= "$encoded_content\r\n";
  $header .= "--$num--";

  # Send email now
  $retval = mail ( $to, $subject, "", $header );
  if( $retval == true )
   {
      echo "Message sent successfully...";
   }
   else
   {
      echo "Message could not be sent...";
   }
?>

```

When I try to send the resume using the form, I get the following error:

> 
> Error in opening file
> 
> 
> 

Can someone please tell me where is the issue and how to resolve it.