title: Fatal error: Uncaught exception 'PHPExcel_Reader_Exception' with message 'Could not open for reading! File does not exist
body: <p>In my script i´d like to read a .xls file with "browse &amp; input file", then i wan´t PHPExcel to read/load the .xls and insert the cell values into mysql.</p>
  
  <p>I had this script working with static file: $path = 'file.xls';
  But i can´t get the upload script to work with my code.</p>
  
  <p>ERROR:
  Fatal error: Uncaught exception 'PHPExcel_Reader_Exception' with message 'Could not open for reading! File does not exist</p>
  
  <p>Can someone please tell me what´s wrong?
  Or is there some code i'm missing?</p>
  
  <p>HTML Select file:</p>
  
  <pre><code>&lt;form class="form-horizontal well" action="php/import_excel.php" method="post"  name="import_excel" enctype="multipart/form-data"&gt;
                  &lt;h4&gt;Ladda upp tabell&lt;/h4&gt;
                      &lt;div class="input-group"&gt;
                          &lt;span class="input-group-btn"&gt;
                              &lt;span class="btn btn-primary btn-file"&gt;
                                  Bläddra&amp;hellip; &lt;input type="file" multiple&gt;
                              &lt;/span&gt;
                          &lt;/span&gt;
                          &lt;input type="text" class="form-control" readonly&gt;
                      &lt;/div&gt;
                      &lt;span class="help-block"&gt;
                          Välj en excel fil
                      &lt;/span&gt;
                      &lt;div class="pull-right"&gt;
                          &lt;button type="submit" id="submit" name="Import" class="btn btn-primary  button-loading" data-loading-text="Loading..."&gt;Ladda upp&lt;/button&gt;
                      &lt;/div&gt;
                      &lt;br /&gt;
                  &lt;/form&gt;
  </code></pre>
  
  <p>PHP Read and insert to mysql:</p>
  
  <pre><code>//Load phpexcel includes    
  require '../Classes/PHPExcel.php';
  require_once '../Classes/PHPExcel/IOFactory.php';
  
  //Establish connection to mysql
  $conn=mysql_connect($host,$username,$password) or die("Could not connect");
  mysql_select_db($dbname,$conn) or die("could not connect database");
  
  //Load file
  if(isset($_POST["Import"])){
  echo $path=$_FILES["file"]["tmp_name"];
  
  //$path = "atbl.xls";
  $objPHPExcel = PHPExcel_IOFactory::load($path);
  
  //Loop threw file to get data
  foreach ($objPHPExcel-&gt;getWorksheetIterator() as $worksheet) {
      $worksheetTitle     = $worksheet-&gt;getTitle();
      $highestRow         = 20; //$worksheet-&gt;getHighestRow(); // e.g. 10
      $highestColumn      = 'G'; //$worksheet-&gt;getHighestColumn(''); // e.g 'F'
      $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);
      $nrColumns = ord($highestColumn) - 64;
  
  //Echo file info
  echo "&lt;br&gt;The worksheet ".$worksheetTitle." has ";
  echo $nrColumns . ' columns (A-' . $highestColumn . ') ';
  echo ' and ' . $highestRow . ' row.';
  echo '&lt;br&gt;Data: &lt;table border="1"&gt;&lt;tr&gt;';
  
  //Loop threw colum, rows and cells
  for ($row = 11; $row &lt;= $highestRow; ++ $row) {
      echo '&lt;tr&gt;';
      for ($col = 0; $col &lt; $highestColumnIndex; ++ $col) {
          $cell = $worksheet-&gt;getCellByColumnAndRow($col, $row);
          $val = $cell-&gt;getCalculatedValue();
          //$dataType = PHPExcel_Cell_DataType::dataTypeForValue($val);
          echo '&lt;td&gt;' . $val . '&lt;br&gt;&lt;/td&gt;';
      }
      echo '&lt;/tr&gt;';
  }
  echo '&lt;/table&gt;';
  }
  
  for ($row = 11; $row &lt;= $highestRow; ++ $row) {
  $val=array();
  for ($col = 0; $col &lt; $highestColumnIndex; ++ $col) {
  $cell = $worksheet-&gt;getCellByColumnAndRow($col, $row);
  $val[] = $cell-&gt;getCalculatedValue();
  }
  //Insert data from file to mysql 
  $sql="INSERT INTO phpexcel(objekt_nr, objekt_rev, element_nr, element_langd, element_bredd,  element_hojd)
  VALUES ('".$val[0] . "','" . $val[1] . "','" . $val[2]. "','" . $val[4]. "','" . $val[5]. "','" .   $val[6]. "')";
  //echo $sql."\n";
  mysql_query($sql) or die('Invalid query: ' . mysql_error());
  }
  }
  ?&gt;
  </code></pre>