<?php
error_reporting(E_ALL);
ini_set('display_errors', True);
$uploadPath = Yii::app()->basePath . '/../uploads/excelfiles/';
$error = '';
if (isset($_POST['btnexlsubmit'])) {
    if (!empty($_FILES["exlfile"]["name"])){
        $tmpFile = $_FILES['exlfile']['tmp_name'];
        $file = $_FILES["exlfile"]["name"];
        $file2 = explode('.', $file);
        $partname = $file2[0];
        $partext = $file2[1];
        if ($partext == "xlsx") {
            $mfileName = $partname . "." . $partext;
            $_SESSION['fileNameinSess'] = $mfileName;
            move_uploaded_file($tmpFile, $uploadPath . '/' . $mfileName);
            Yii::app()->controller->redirect(array('/user/excel/'));
        } else {
            $error = "Please Use XLSX Extension File Excel(2007)";
        }
    } else {
        $error = 'Please Upload files';
    }
}
?>

<form name="frmexcel" method="post" enctype="multipart/form-data" action="">
      <div class="erros alert-error"><?php echo $error; ?></div>
    <div class="row">
        <div class="span6">
            <div class="row-fluid">
                <div class="span4"><label>Upload Excel File:</label></div>
                <div class="span6"><input type="file" name="exlfile" id="exlfile" ></div>
            </div>
            <br><div class="clear"></div>
            <div class="row-fluid">
                <input type="submit" name="btnexlsubmit" value="Submit" class="btn btn-info">
            </div>
        </div>
        <div class="span6"></div>
    </div>
</form>