why my upload() function is not working?
<p>I try to upload a file and save it in a different directory. But is_uploaded_files does not pass and causes error. Please help</p>

<pre><code>   function getDocument(){
    $documents=array();
    $id=1;
    if(isset($_FILES['upload'])){enter code here
        $file=$_FILES['upload']['tmp_name'];
        $file_name=$_FILES['upload']['name'];
        $file_type=$_FILES['upload']['type'];
        $d=new Document();
        upload($file,$file_name);               
        $d-&gt;Name=$file_name;
        $d-&gt;ID=$id++;
        //$temp=explode('.', $file_name);
        //$ext=array_pop($temp);
        $d-&gt;FileExtension=$file_type;
        array_push($documents, $d);
    }

    return $documents;
}
</code></pre>

<p>In the above function, upload will be called and that is where an error comes from</p>

<pre><code>function upload($file,$file_name){
    $dir='resources/';
        if(is_uploaded_file($file)){
            if(!move_uploaded_file($file, $dir)){
                echo "File Internal Error";
                exit;
            }
        }
        else{
            echo "Unable to upload";
            exit;
        }

}
</code></pre>

<p>/<em>Here is a HTML</em>/</p>

<pre><code>        &lt;html&gt;
        &lt;head&gt;
            &lt;title&gt;Admin Docusign Browser&lt;/title&gt;

        &lt;/head&gt;
        &lt;body&gt;

            &lt;form id="DocumentForm" enctype="multipart/form_data" method="post"&gt;
                Subject:
                &lt;input id="subject" name="subject" type="text" placeholder="&lt;enter the subject&gt;" autocomplete="off" /&gt;
                &lt;br /&gt;
                    &lt;textarea rows="4" cols="30" name="emailContent" placeholder="&lt;enter your content&gt;" class="email" &gt;Content&lt;/textarea&gt;
                &lt;br /&gt;
                &lt;br /&gt;
                &lt;?php 
                function addRecipientRowToTable(){
                    while(isset($POST['click'])){

                    }
                }
                ?&gt;
                &lt;table id="recipientList" name="recipientList" class="recipientList"&gt;
                    &lt;tr class="recipientListHeader"&gt;
                        &lt;th&gt;
                            Recipient   
                        &lt;/th&gt;
                        &lt;th&gt;
                            Email   
                        &lt;/th&gt;
                    &lt;/tr&gt;
                    &lt;tr id="Recipient1"&gt;
                        &lt;td&gt;
                            &lt;input type="text" name="RecipientName[1]" id="row1" value=""&gt;
                        &lt;/td&gt;
                        &lt;td&gt;
                            &lt;input type="text" name="RecipientEmail[1]" id="row1" value=""&gt;
                        &lt;/td&gt;
                    &lt;/tr&gt;

                &lt;/table&gt;
                &lt;input type="button" onclick="addRecipientRowToTable()" name="click" value="Add Recipient"/&gt;
                &lt;br /&gt;
                &lt;br /&gt;

                Attach Document:
                &lt;input type="hidden" name="MAX_FILE_SIZE" value="1000000"&gt;
                &lt;input name="upload" type="file" value="browse to a file"&gt;
                &lt;br /&gt;
                Edit Document Before Sending:
                &lt;input type="button" name="edit" value="Edit"&gt;
                &lt;br /&gt;
                Send Document:  
                &lt;input type="submit" name="send" value="Send"&gt;
            &lt;/form&gt;
        &lt;/body&gt;

    &lt;/html&gt;`enter code here`
</code></pre>

<hr>
