AngularJS-ajax-MVC文件无表单数据多次上传

AngularJS-ajax-MVC文件无表单数据多次上传,angularjs,ajax,model-view-controller,multipartform-data,flow-js,Angularjs,Ajax,Model View Controller,Multipartform Data,Flow Js,我使用Flow.JS上传文件 我的要求是,我必须在单击一个保存按钮后发送以下数据 多个文件 两个字符串值与文件一起 下面的方法很好 上传ajax调用 $scope.UploadFiles = function (flows) { var data = new FormData(); $.each(flows.files, function (i, flowfile) { data.append('file' + i, flowfile.file);

我使用Flow.JS上传文件

我的要求是,我必须在单击一个保存按钮后发送以下数据

  • 多个文件
  • 两个字符串值与文件一起 下面的方法很好

    上传ajax调用

        $scope.UploadFiles = function (flows) {
        var data = new FormData();
        $.each(flows.files, function (i, flowfile) {
            data.append('file' + i, flowfile.file);
        });
    
        data.append('message', $scope.Subject);
        data.append('subject', $scope.Message);
    
     $.ajax({
            url: 'url\savedata',
            data: files,
            cache: false,
            contentType: false,
            processData: false,
            type: 'POST'
        }); 
    
    }
    
    还有我的MVC控制器

        public JsonResult Savedata()
        {
    
            var httpRequest = System.Web.HttpContext.Current.Request;
            if(httpRequest.Files.Count != 0)
            {
                var collection = 0;
                foreach (string file in httpRequest.Files)
                {
                  //manipulate file data
                }
            }
    
             var message = httpRequest.Forms['message'];
             var subject= httpRequest.Forms['subject'];
    
        }
    
    这一切都很好。我想知道是否有更好的方法来实现这一点,而不是使用表单数据,并可能使用数据模型来发送所有数据,因为我需要它来进行一些MVC数据验证