Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/28.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
Php 使用文本框从角度控制器发送多个图像数据_Php_Angularjs_Angularjs Scope - Fatal编程技术网

Php 使用文本框从角度控制器发送多个图像数据

Php 使用文本框从角度控制器发送多个图像数据,php,angularjs,angularjs-scope,Php,Angularjs,Angularjs Scope,我想将带有文本框值的多个图像数据发送到服务器端(PHP)。我已完成多个图像上载,但在提交表单时无法将数据发送到服务器端。我的查看代码如下 <form ng-submit="save()"><input type="file" file-upload multiple> <div ng-repeat="step in files"> <img ng-src="{{step}}" />{{step.name}} <input ty

我想将带有文本框值的多个图像数据发送到服务器端(PHP)。我已完成多个图像上载,但在提交表单时无法将数据发送到服务器端。我的查看代码如下

<form ng-submit="save()"><input type="file" file-upload multiple>
<div ng-repeat="step in files">
    <img ng-src="{{step}}" />{{step.name}}
    <input type="text" ng-model="comments">
</div>
<input type="submit"></form>

您需要使用
$http
服务将图像发送到服务器

$scope.save = function() {
    var fd = new FormData();
    fd.append('file', $scope.files);
    $http.post('uploadUrl', fd, {
            transformRequest: angular.identity,
            headers: {
                'Content-Type': undefined
            }
        })
        .then(function(response) {})
        .catch(function(response) {});
}

您需要使用
$http
服务将图像发送到服务器

$scope.save = function() {
    var fd = new FormData();
    fd.append('file', $scope.files);
    $http.post('uploadUrl', fd, {
            transformRequest: angular.identity,
            headers: {
                'Content-Type': undefined
            }
        })
        .then(function(response) {})
        .catch(function(response) {});
}

我想将带有imagechange ng模型变量的文本框值发送到文件对象属性。与
类似,如果我将console.log($scope.files)放在fd.append('file',$scope.files)之后,这会将注释绑定到文件数组对象;无法获取任何图像名称请对此进行plunkr,但我无法预览我的图像我想将带有imagechange ng模型变量的文本框值发送到文件对象属性。与
类似,如果我将console.log($scope.files)放在fd.append('file',$scope.files)之后,这会将注释绑定到文件数组对象;无法获取任何图像名称您可以为此制作plunkr吗?但是在这里我无法预览我的图像
$scope.save = function() {
    var fd = new FormData();
    fd.append('file', $scope.files);
    $http.post('uploadUrl', fd, {
            transformRequest: angular.identity,
            headers: {
                'Content-Type': undefined
            }
        })
        .then(function(response) {})
        .catch(function(response) {});
}