//前端
<label class="btn blue" title="批量导入" for="fileToUpload">导入</label><br />
@using (Html.BeginForm("UploadTrainee", "Trainee", FormMethod.Post, new { enctype = "multipart/form-data", id = "uploadFile" }))
{
<input type="file" name="fileToUpload" id="fileToUpload" οnchange="fileSelected();" style="display:none; " />
}
//js
function fileSelected() {
var file = $("#fileToUpload").prop("files")[0];
if (file) {
var fileType = file.type;
if (fileType != 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' && fileType != "application/vnd.ms-excel")
{
showE