<?php
require_once 'dao/Admission.php';

if(isset($_FILES['hse']))
{
	print_r($_FILES);


echo $filename=$_FILES["hse"]["tmp_name"];
$ext=substr($filename,strrpos($filename,"."),(strlen($filename)-strrpos($filename,".")));

//we check,file must be have csv extention
// if($ext=="csv")
// {
  $file = fopen($filename, "r");
         while (($emapData = fgetcsv($file, 10000, ",")) !== FALSE)
         {
         	
          $sn = $emapData[0];
          $student_id = $emapData[1];
          $student_name = $emapData[2];
          $house_id = $emapData[3];
        $data = array("house_id"=>$house_id);
        print_r($data);
           $success =  $admission->update($data,$student_id);
           if ($success) {
           	echo 0;
           }else{
           	echo 1;
           }
           //break;
         }
         fclose($file);
         echo 3;
// }
// else {
//     echo "Error: Please Upload only CSV File";
// }


}

?>