public JsonResult UploadFile(IFormFile file) { // TODO 限制文件大小 if (file == null) { throw new UserFriendlyException("No file found!"); } if (file.Length <= 0) { throw new UserFriendlyException("File is empty!"); } var fileResult = _fileStoreManager.SaveFileAndGetResult( new FileInfo { Bytes = file.GetAllBytes(), FileName = file.FileName, FileSize = file.Length, FileType = file.ContentType } ); return(Json(fileResult)); }