如何使用ng-flow发送多个文件上传发布请求?

时间:2016-06-20 12:20:41

标签: javascript angularjs circular-reference multiple-file-upload ng-flow

这里我使用ng-flow进行多文件上传ng-flow
Html在这里

  <div  flow-init flow-files-submitted="img_upload($file, $event, $flow )" >

        <img flow-img="$flow.files[0]" />
        <img flow-img="$flow.files[1]" />
        <img flow-img="$flow.files[2]" />
        <img flow-img="$flow.files[3]" />
        <img flow-img="$flow.files[4]" />
        <span class="btn btn-primary" flow-btn>Upload File</span>
    </div>

控制器

   $scope.img_upload = function($file, $event, $flow) {
        console.log($flow.files);
        var url = '/api/media';
            $http.post(url,{
                files:$flow.files,
                type:'images'
            })
            .then(function(response) {
                console.log(files);
               console.log('success')
            }, function(response) {

            });


    }

当我上传图片时,我在Chrome中的TypeError: Converting circular structure to JSON和firefox中的Error: cyclic object value收到错误。该怎么做,谁能帮助我。

0 个答案:

没有答案