How to send multiple file upload post request using ng-flow?

362 Views Asked by At

Here i am using ng-flow for multiple file upload ng-flow.
Html goes here

  <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>

controller

   $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) {

            });


    }

I am getting the error as TypeError: Converting circular structure to JSON in chrome and Error: cyclic object value in firefox, when i upload images. how to do it , can anyone please help me.

0

There are 0 best solutions below