Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/fsharp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用AngularJS发布多个图像_Angularjs - Fatal编程技术网

使用AngularJS发布多个图像

使用AngularJS发布多个图像,angularjs,Angularjs,当我使用angular js发布多个图像时,它并没有发布到服务器上 但当我发布一张图片时,效果非常好 请帮我解决这个问题 下面是我的代码 var jsonData=$scope.form; $http({ method: 'POST', url: Serve.base + '/groupview/' + $scope.group

当我使用angular js发布多个图像时,它并没有发布到服务器上 但当我发布一张图片时,效果非常好 请帮我解决这个问题 下面是我的代码

var jsonData=$scope.form;
        $http({
            method: 'POST',                                                     
            url: Serve.base + '/groupview/' + $scope.groupid,                             
            headers : { 'Content-Type': undefined },
            transformRequest: function (data) {
            data._method = 'PUT';
            var formData = new FormData();
            formData.append("model", angular.toJson($scope.form));
            console.log(data);
            console.log($scope.form.gallery_image);
            JSONObj = $scope.form.gallery_image;
            jQuery.each(JSONObj, function (j, files) {
                console.log(files)
                console.log(j)
                jQuery.each(JSONObj[j], function (k, file) {
                    console.log(file)
                    console.log(k)
                    formData.append('upload_image'+k, file);
                });
            });

我不确定,但可能您忘记了表单上的enctype=“multipart/form data”attr已添加到表单单一图像中,在发布多个图像时其工作正常。您可以在代码中为我们提供console.log的输出吗?[File,File,File,File,File,File,File,File]group.js?a:152文件{name:“jummy.jpg”,lastModified:1247549551674,lastModifiedDate:2009年7月14日星期二10:32:31 GMT+0500(巴基斯坦标准时间),webkitRelativePath:,size:879394…}group.js?a:1530 group.js?a:155 hummery.jpg group.js?a:156 name group.js?a:155 1247549551674 group.js?a:156 lastModified group.js?a:155 2009年7月14日星期二10:32:31 GMT+0500(巴基斯坦标准时间)757:4030成功如果有可能,请编辑您的问题并添加输出,在评论中不容易阅读