这里我使用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
收到错误。该怎么做,谁能帮助我。