title: PHP code to download .pdf & .docx files from folder stored my Wamp Server
body: <p>I wrote a PHP code to upload .pdf as well as .docx files to a folder created in my WWW directory (WAMP Server)
  Here is piece of the code that uploads the files:</p>
  
  <pre><code>&lt;?php
  if ( ( ($_FILES["file"]["type"] == "application/vnd.openxmlformats-  officedocument.word") || ($_FILES["file"]["type"] == "application/pdf")
  || ($_FILES["file"]["type"] == "application/x-pdf") || ($_FILES["file"] ["type"] == "application/acrobat")
  || ($_FILES["file"]["type"] == "applications/vnd.pdf") || ($_FILES["file"]["type"] == "text/pdf") || ($_FILES["file"]["type"] == "text/x-pdf")) 
  &amp;&amp; ($_FILES["file"]["size"]&lt;5000000))
  {
  if ($_FILES["file"]["error"] &gt; 0)
      {
       echo "Error: " . $_FILES["file"]["error"] . "&lt;br/&gt;";
    }
   else
  {    
  if (file_exists("CVs/".$_FILES["file"]["name"]))
    {
    echo $_FILES["file"]["name"] ."already exists";
    }
  else
    {
    move_uploaded_file($_FILES["file"]["tmp_name"],
    "CVs/" . $_FILES["file"]["name"]);
   $cv=$_FILES["file"]["name"]; 
  </code></pre>
  
  <p>The above code works well to upload .pdf files but not .docx files. I need to know my mistake to upload .docx files.</p>
  
  <p>I wrote a PHP code again to download the uploaded .pdf files.
  My code seems like below:</p>
  
  <pre><code>&lt;?php
     $connect=mysql_connect("localhost","root","");
           if(!$connect)   die("Server failed to connect ".mysql_error());
           mysql_select_db("geosas_rosterofexperts") or die(mysql_error());
           $result=mysql_query("SELECT * FROM user_table");
          while($row=mysql_fetch_array($result))
           {
                   $id=$row["id"];
                  $fname=$row["fname"];
                  $mname= $row["mname"];
                  $lname=$row["lname"];
                  $gender=$row["gender"];
                  $address=$row["address"];
                  $country=$row["country"];
                  $mobile=$row["mobile"];
                  $email=$row["email"];
                  $altmail=$row["altmail"];
                  $education=$row["education"];
                  $field=$row["field"];
                  $certification=$row["award"];
                  $cv=$row["cv"];
                  echo "".$id."";
                  echo "&lt;table width='100%' border='1px'&gt;
                  &lt;tr style='Background-color:#CCCCCC;'&gt;
                  &lt;td&gt;&lt;a href='file_update.php?id=$id'&gt;Update&lt;/a&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;a href='file_delete.php?id=$id'&gt;Delete&lt;/a&gt;&lt;/td&gt;
                  &lt;/tr&gt;
  
                  &lt;tr&gt;
                  &lt;td&gt; &lt;p style='color:#FF3300;'&gt;First name&lt;/p&gt; ".$fname."&lt;/td&gt;
                  &lt;td&gt; &lt;p style='color:#FF3300;'&gt;Middle name&lt;/p&gt; ".$mname."&lt;/td&gt; 
                  &lt;/tr&gt;
  
                  &lt;tr&gt;
                  &lt;td&gt; &lt;p style='color:#FF3300;'&gt;Last name&lt;/p&gt; ".$lname."&lt;/td&gt;
                  &lt;td&gt; &lt;p style='color:#FF3300;'&gt;Gender&lt;/p&gt; ".$gender."&lt;/td&gt; 
                  &lt;/tr&gt;
                  &lt;tr&gt;
                  &lt;td colspan=2&gt; &lt;p style='color:#FF3300;'&gt;Address&lt;/p&gt; ".$address."&lt;/td&gt;
                  &lt;/tr&gt;
  
                  &lt;tr&gt;
                  &lt;td&gt; &lt;p style='color:#FF3300;'&gt;Country&lt;/p&gt; ".$country."&lt;/td&gt;
                  &lt;td&gt; &lt;p style='color:#FF3300;'&gt;Mobile&lt;/p&gt; ".$mobile." &lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                  &lt;td&gt; &lt;p style='color:#FF3300;'&gt;Email&lt;/p&gt; ".$email." &lt;/td&gt;
                  &lt;td&gt; &lt;p style='color:#FF3300;'&gt;Alt.Email&lt;/p&gt; ".$altmail."&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                  &lt;td&gt; &lt;p style='color:#FF3300;'&gt;Education&lt;/p&gt; ".$education."&lt;/td&gt;
                  &lt;td&gt; &lt;p style='color:#FF3300;'&gt;Field&lt;/p&gt; ".$field."&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                  &lt;td&gt;&lt;p style='color:#FF3300;'&gt;Specialization&lt;/p&gt; ".$certification."&lt;/td&gt;    
                  &lt;td&gt;&lt;a href='CVs/'".$cv."'&gt;CV&lt;/a&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;/table&gt;
                  ";          
           } 
  ?&gt;
  </code></pre>
  
  <p>This link takes me to a folder that contains the uploaded files but what I need is to take me to the exact file according to the ID and to download the file when I click the "CV" link. So, please help me</p>