在IE11中Excel文件上传无效

时间:2015-07-07 10:52:51

标签: javascript asp.net-mvc visual-studio-2013 asp.net-mvc-5

我有以下方法将excel上传到我的ASP.NET MVC应用程序。这在mozilla和chrome中运行良好,但在IE中。

        public ActionResult FileUploadForBookCreation(HttpPostedFileBase file)
    {
        try
        {
            bool errorvalue = false;
            bool duplicateInFile = false;
            var lstProductDetails = new List<ProductDetailsForBooksExcel>();
            var objProductDetailsvalidation = new ProductDetailsvalidation();
            var objproductViewModel = new ProductViewModel();
            var lstProductDetailsvalidation = new List<ProductDetailsvalidation>();
            string extension = Path.GetExtension(file.FileName);
            string validation;
            if (extension.Equals(".xls") || extension.Equals(".xlsx"))
            {
                var fileName = Path.GetFileName(file.FileName);
                var path = Path.Combine(Server.MapPath("~/Content/Upload"), fileName);

                file.SaveAs(path);
                ValidateBookCreationfile(path, false, objProductDetailsvalidation, lstProductDetails, objproductViewModel, lstProductDetailsvalidation);

                if (lstProductDetailsvalidation.Any())
                {

                    return Json(lstProductDetailsvalidation);
                }
                return Json(lstProductDetails);
            }
            else
            {
                return Json("Error");
            }
        }
        catch (System.Exception)
        {
            return Json("Error");
        }
    }

任何人都知道为什么它只在IE11中发生? :(

0 个答案:

没有答案