title: Upload File PHP with popup
body: <p>Good day,<br>
  I was currently design a <strong>form</strong> that has 10 fields (3 of them requires upload file while the others are using normal <code>&lt;input&gt;</code> functions). Here i will only show a sample code for my form with the upload function that will trigger the popup box when the user clicks on the input on the form.</p>
  
  <pre><code>&lt;form name="form1" action="process.php" method="post"&gt;
      &lt;input type="text" id="form_ic" name="form_ic" size="30" onClick="return popup('pdf.php')"&gt;
      &lt;a href="javascript:popup('pdf.php')"&gt;[Upload]&lt;/a&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>For the upload file functions, i will need to do a popup box (pdf.php) from the original form php to show the terms stated for the files to be uploaded (eg. the file must be only .pdf and so on). The real upload function is only implemented on the form in pdf.php as follows:</p>
  
  <pre><code>&lt;form name="pdf_upload" action="index.php" method="post" accept-charset="utf-8" enctype="multipart/form-data"&gt;
      &lt;input type="file" name="uploadfile" id="uploadfile"&gt;
      &lt;button type="submit" name="submit" value="Upload" onClick="window.close();"&gt;Upload&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Here's the catch,  </p>
  
  <p>The purpose for this original form is to register the user profile. So what i want to do is that after user select the file from the upload popup box the file will be transferred back to the original form. The <strong>name of the file</strong> uploaded by the user will be displayed in the <code>&lt;input type="text" id="form_ic"&gt;</code> back in the original form. The pdf file transferred back to the original form will be submitted along with other field details (eg. name, age, etc). For your information, since there are <strong>3 fields</strong> using the same upload function with popup, I will implement the same popup function.</p>
  
  <p>I'm stuck of transferring the pdf file from the popup php to the original form php and to display the name of the uploaded file back in the original form php. I really need opinions from the community to solve this problem.</p>
  
  <p>I am well aware that to display the name of .pdf file to the <code>&lt;input&gt;</code>, you'll require the javascript <code>.innerHTML</code> function, but i just can't retrieve the uploaded .pdf file from the pdf.php. It may be due to the problem with my code design. I'm not sure whether AJAX is required for my problem. Please help me.  </p>
  
  <p>Thank you.   </p>