title: Putting default value in <input type=file....>
body: <blockquote>
    <p><strong>Note:</strong></p>
    
    <p>The answers &amp; comments below reflect the state of legacy browsers in 2009. Now you can actually set the value of the file input element dynamically/programatically using JavaScript in 2017.</p>
    
    <p>See the answer in this question for details as well as a demo:<br><a href="https://stackoverflow.com/q/47515232/584192">How to set file input value programatically (i.e.: when drag-dropping files)?</a></p>
  </blockquote>
  
  <p>I want to update a table. Hence when user wants to update it the insert form appears where the default values appear in the input boxes. But i can't load in the <code>&lt;input type=file....&gt;</code>.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>    &lt;?php
      session_start();
      if(!isset($_SESSION['user']))
          {
              header("Location:index.php");
              exit();
          }
        include("./include/dbc.php");
        $a=$_REQUEST['apt'];
      $qry="select * from flats where app_name = '$a'";
      $result=mysql_query($qry) or die(mysql_error());
      while($res = mysql_fetch_array($result))
      {
       $ai=$res[0];
       $an=$res[1];
       $bn=$res[2];
       $lc=$res[3];
       $st=$res[4];
       $nf=$res[5];
       $ct=$res[6];
       $mp=$res[7];
       $lm=$res[8];
      }
  
      ?&gt;
      &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
      &lt;form id="form1" action="details1.php?ar=&lt;?php echo $a;?&gt;&amp;api=&lt;?php echo $ai;?&gt;" method="post" enctype="multipart/form-data"&gt;
      &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
      &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
      &lt;title&gt;Welcome To Prime Properties&lt;/title&gt;
      &lt;link rel="stylesheet" href="style.css" type="text/css"/&gt;
  
      &lt;/head&gt;
  
      &lt;body&gt;
         &lt;div class="container"&gt;
              &lt;div class="heading"&gt;
                  &lt;div class="banner"&gt;&lt;img src="../images/top.jpg" width="995" height="169" /&gt;&lt;/div&gt;
              &lt;!--menu start--&gt;
                  &lt;div&gt;
                      &lt;?php  include('include/menu.php');?&gt;
                      &lt;/div&gt;
              &lt;!--menu end--&gt;
  
              &lt;/div&gt;
              &lt;div class="main"&gt;
              &lt;!--left menu start--&gt;
                  &lt;div class="left_menu"&gt;
                  &lt;?php  include('include/lm.php');?&gt;
                  &lt;/div&gt;
              &lt;!--left menu end--&gt;
              &lt;div class="divider"&gt;&lt;/div&gt;
              &lt;!--body contant goes here--&gt;
              &lt;div class="right"&gt;
                          &lt;p&gt;
                              &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Enter Your Credentials......&lt;/p&gt;
                             &lt;fieldset&gt;&lt;p class="first"&gt;
                                     &lt;label for="a_name" &gt;Appartment Name:&lt;/label&gt;
                                      &lt;input type="text" name="a_name" id="a_name" value="&lt;?php echo $an;?&gt;"&gt;&lt;br/&gt;&lt;/input&gt;&lt;/p&gt;
                  &lt;p&gt;
                                  &lt;label for="b_name"&gt;Builder Name:&lt;/label&gt;
                                  &lt;input type="text" name="b_name" id="b_name" value="&lt;?php echo $bn;?&gt;"&gt;&lt;br/&gt;&lt;/input&gt;&lt;/p&gt;
                              &lt;p&gt;
                               &lt;label for="loc"&gt;Location:&lt;/label&gt;
                               &lt;select name="loc"&gt;
                                   &lt;?php $qry1="select location from location where loc_id='$lc'";
                                                              $result1=mysql_query($qry1) or die(mysql_error());
                                                                  while($res = mysql_fetch_array($result1)){
                                                              $op=$res[0];
                                                              }?&gt;
                                  &lt;option value="&lt;?php echo $lc?&gt;"&gt;&lt;?php echo $op;?&gt;&lt;/option&gt;
                                  &lt;option value="1"&gt;Maligaon&lt;/option&gt;
                              &lt;/select&gt;&lt;br/&gt;&lt;/p&gt;
                              &lt;p&gt;
                                  &lt;label for="status"&gt; Status:&lt;/label&gt;
                                  &lt;select name="status"&gt;
                                      &lt;?php $qry1="select status from status where st_id='$st'";
                                                              $result1=mysql_query($qry1) or die(mysql_error());
                                                                  while($res = mysql_fetch_array($result1)){
                                                              $sts=$res[0];
                                                              }?&gt;
                                  &lt;option value="&lt;?php echo $st?&gt;"&gt;&lt;?php echo $sts;?&gt;&lt;/option&gt;
                                  &lt;option value="1"&gt;Ongoing&lt;/option&gt;
                                  &lt;option value="2"&gt;Future&lt;/option&gt;
                                  &lt;option value="3"&gt;Completed&lt;/option&gt;
                              &lt;/select&gt;&lt;br/&gt;&lt;/p&gt;
                                 &lt;p&gt;&lt;label for="no_flats"&gt;No of Flats:&lt;/label&gt;
                                    &lt;input type="text" name="no_flats" id="no_flats" value="&lt;?php echo $nf;?&gt;"&gt;&lt;br/&gt;&lt;/input&gt;&lt;/p&gt;
                              &lt;p&gt;&lt;label for="c_time"&gt;Completion Time:&lt;/label&gt;
                                  &lt;?php $ct1=explode("  ", $ct);
                                  ?&gt;
                                  &lt;select name="month"&gt;
                                      &lt;option&gt;&lt;?php echo $ct1[0];?&gt;&lt;/option&gt;
                                      &lt;option&gt;January&lt;/option&gt;
                                      &lt;option&gt;February&lt;/option&gt;
                                      &lt;option&gt;March&lt;/option&gt;
                                      &lt;/select&gt;
                                  &lt;select name="year"&gt;
                                      &lt;option&gt;&lt;?php echo $ct1[1];?&gt;&lt;/option&gt;
                                      &lt;option&gt;2012&lt;/option&gt;
                                      &lt;option&gt;2013&lt;/option&gt;
                                      &lt;option&gt;2014&lt;/option&gt;
                                  &lt;/select&gt;
                                      &lt;/p&gt;
                              &lt;p&gt;&lt;label for="m_pic"&gt;Main Picture:&lt;/label&gt;
                                  &lt;td&gt;&lt;img src="images/&lt;?php echo $mp?&gt;" width="100" height="70" /&gt;&lt;/td&gt;
                              &lt;input type="file" name="photo"&gt;&lt;br/&gt;&lt;/input&gt;&lt;/p&gt;
                              &lt;p&gt;&lt;label for="l_map"&gt;Location Map:&lt;/label&gt;
                                  &lt;td&gt;&lt;img src="loc_images/&lt;?php echo $lm?&gt;" width="100" height="70" /&gt;&lt;/td&gt;
                                &lt;input type="file" name="photo"&gt;&lt;br/&gt;&lt;/input&gt;&lt;/p&gt;
                                 &lt;p class="submit"&gt;
                                     &lt;input type="hidden" name="check" value="1"/&gt;
                                     &lt;button type="submit" name="submit" &gt;UPDATE&lt;/button&gt;&lt;/p&gt;
                             &lt;/fieldset&gt;&lt;/div&gt;
  
              &lt;!--body contant end here --&gt;
          &lt;/div&gt;
  
  
      &lt;/body&gt;
      &lt;/html&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>What i should do?</p>