title: .xls file can be imported but not the .xlsx into MYSQL Database
body: <p>The below is the code which i tried for importing file(excel/csv) into MYSQL Database using php. This imports only the files with .xls extension and not .xlsx 
  May i know whats the mess with the code, either we have to include any library into the code or any change should be made.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
   &lt;?php 
   include 'connect.php';
   include 'Excel/reader.php';
   function uploadFile($fieldName, $fileType, $folderName, $name = "")
   {
      $flg = 0;
      $MaxID = "";
      $ext = "";
      $uploadfile = "";
      if (isset($fieldName) AND $fieldName['name'] != '')
      {
          $flg = 1;
          $allowed_filetypes = $fileType;
          $max_filesize = 1048576;
          $filename = $fieldName['name'];
          if ($name == "")
              $MaxID = time() . time() . rand(1, 100);
          else
              $MaxID = $name;
          $ext = substr($filename, strpos($filename, '.'), strlen($filename) - 1);
    if($ext==".xlsx")
  $ext=".xlsx";
          if (!in_array($ext, $allowed_filetypes))
              echo "&lt;h1&gt;The file you attempted to upload is not allowed...&lt;/h1&gt;";
          else if (filesize($fieldName['tmp_name']) &gt; $max_filesize)
              echo "&lt;h1&gt;The file you attempted to upload is too large...&lt;/h1&gt;";
          else 
          {
              $uploadfile = $folderName . "/" . $MaxID . $ext;
              if (move_uploaded_file($fieldName['tmp_name'], $uploadfile) == FALSE)
              {
                  echo "&lt;h1&gt;Error in Uploading File...&lt;/h1&gt;";
                  $MaxID = "";
              }
              else
                  $MaxID = $MaxID . $ext;
          }
      }
      return $MaxID;
    }
    if(isset($_POST['submit']))
   {
   if($_FILES['csvFile']['name']!="")
   {
   $fileName=uploadFile($_FILES['excelFile'],array(".csv"),"excel_file");
   $row=0;
   if(($handle = fopen("test.csv".$fileName , "r")) !== FALSE) 
   {
   while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) 
   {
   $num = count($data);
   //print_r($data);
   $query="INSERT INTO  dealer_tbl(firstname,lastname,email,phone)VALUES('".$data[0]."','".$data[1]."','".$data[2]."','".$data[3]."')";
   mysql_query($query);
  }
  fclose($handle);
  }
  }
  else if($_FILES['excelFile']['name']!="")
  {
  $fileName=uploadFile($_FILES['excelFile'],array(".xls",".xlsx"),"excel_file");
  $data = new Spreadsheet_Excel_Reader();
  
  $data-&gt;read('excel_file/'.$fileName);
  
  for($i=1;$i&lt;=$data-&gt;sheets[0]['numRows'];$i++)
  { $title=$data-&gt;sheets[0]['cells'][$i][1];
  $firstname=$data-&gt;sheets[0]['cells'][$i][2];
  $lastname=$data-&gt;sheets[0]['cells'][$i][3];
  $mobile=$data-&gt;sheets[0]['cells'][$i][4];
  $phone=$data-&gt;sheets[0]['cells'][$i][5];
  echo $firstname."','".$lastname."','".$mobile."','".$phone;
  $query="INSERT INTO  dealer_tbl(title,firstname,lastname,email,phone)VALUES('".$title."','".$firstname."','".$lastname."','".$mobile."','".$phone."')";
  mysql_query($query);
  }
  }
  }
  if(isset($_POST['delete']))
  {
  mysql_query("DELETE FROM StudentData");
  }
  ?&gt;
  
  &lt;html lang="en"&gt;
  &lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;title&gt;&lt;/title&gt;
  &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
  &lt;meta name="description" content=""&gt;
  &lt;link rel="stylesheet" href="master_net_effect.css" type="text/css" media="screen"&gt;
  
  &lt;link rel="stylesheet" href="css/bootstrap.min.css"&gt;
  &lt;link rel="stylesheet" href="css/bootstrap-responsive.min.css"&gt;
  &lt;link rel="stylesheet" href="css/bootstrap-custom.css"&gt;
  
  
  &lt;!-- HTML5 Shim, for IE6-IE8 support of HTML5 elements --&gt;
  &lt;!--[if lt IE 9]&gt;
  &lt;script src="js/html5shiv.js"&gt;&lt;/script&gt;
  &lt;![endif]--&gt;
  
  
      &lt;!-- Google Analytics: change UA-XXXXX-X to be your site's ID. --&gt;
      &lt;script type="text/javascript"&gt;
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-38395785-1']);
  _gaq.push(['_trackPageview']);
  
  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async =  true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') +  '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();
   &lt;/script&gt;
  
   &lt;/head&gt;
   &lt;body&gt;    
  
   &lt;!-- Navbar
   ================================================== --&gt;
  
  
  &lt;div id="header"&gt; &lt;a id="con_logo_link" href="http://s672.t.en25.com/e/er?s=672&amp; lid=3261&amp;elq=00000000000000000000000000000000" target="_blank"&gt;&lt;!-- logo --&gt;&lt;/a&gt;&lt;/div&gt;
  &lt;div id="wrap"&gt;
  &lt;div class="container"&gt;
  &lt;div class="row"&gt;
  &lt;div class="span6" id="form-login"&gt;
  &lt;form class="form-horizontal well" action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;" method="post" name="upload_excel" enctype="multipart/form-data"&gt;
   &lt;fieldset&gt;
    &lt;legend&gt;Import Dealers List&lt;/legend&gt;
    &lt;div class="control-group"&gt;
     &lt;div class="control-label"&gt;
      &lt;label&gt;Select CSV File&lt;/label&gt;
     &lt;/div&gt;
     &lt;div class="controls"&gt;
      &lt;input type="file" name="csvFile" class="input-large"&gt;
     &lt;/div&gt;
    &lt;/div&gt;
    or
    &lt;div class="control-group"&gt;
     &lt;div class="control-label"&gt;
      &lt;label&gt;Select Excel File&lt;/label&gt;
     &lt;/div&gt;
     &lt;div class="controls"&gt;
      &lt;input type="file" name="excelFile" class="input-large"&gt;
     &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="control-group"&gt;
     &lt;div class="controls"&gt;
     &lt;button type="submit" id="submit" name="submit" data-loading-text="Loading..."&gt;Upload&lt;/button&gt;
     &lt;/div&gt;
    &lt;/div&gt;
   &lt;/fieldset&gt;
  &lt;/form&gt;
  &lt;/div&gt;
  &lt;div class="span3 hidden-phone"&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;form name="del" method="post" action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;"&gt;
  &lt;div class="control-group"&gt;
  &lt;div class="controls"&gt;
   &lt;button type="submit" id="delete" name="delete"  data-loading-text="Loading..."&gt;Delete Data&lt;/button&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  &lt;table class="table table-bordered"&gt;
  &lt;tr&gt;
  &lt;th&gt;Title&lt;/th&gt;
  &lt;th&gt;First Name&lt;/th&gt;
  &lt;th&gt;Last Name&lt;/th&gt;
  &lt;th&gt;Mobile&lt;/th&gt;
  &lt;th&gt;Phone&lt;/th&gt;
  &lt;/tr&gt;
  &lt;?php
  $res=mysql_query("SELECT * FROM dealer_tbl");
  while($row=mysql_fetch_array($res))
  {
  ?&gt;
   &lt;tr&gt;
    &lt;td&gt;&lt;?php echo $row['title']; ?&gt;&lt;/td&gt;
    &lt;td&gt;&lt;?php echo $row['firstname']; ?&gt;&lt;/td&gt;
    &lt;td&gt;&lt;?php echo $row['lastname']; ?&gt;&lt;/td&gt;
    &lt;td&gt;&lt;?php echo $row['email']; ?&gt;&lt;/td&gt;
    &lt;td&gt;&lt;?php echo $row['phone']; ?&amp;gt..
  </code></pre>