我需要一起上传照片和视频。
我正在使用ng-file-upload
我的mvc控制器:
[HttpPost]
public ContentResult Add(List<HttpPostedFileBase> file, VideoViewModel item)
{
return Content(_output.ConvertToJson(), "application/json");
}
我的javascript代码:
$scope.item = {
Address: '',
Name: ''
};
$scope.files = [];
$scope.file = null;
$scope.video = null;
$scope.response = {};
$scope.confirmAdd = function () {
if ($scope.add_form.$valid) {
$scope.files[0] = $scope.file;
$scope.files[1] = $scope.video;
$upload.upload({
url: 'User/Add',
method: 'POST',
data: $scope.item,
file: $scope.files,
}) .progress(function (evt) {
$scope.percent = parseInt(100.0 * evt.loaded / evt.total);
}).success(function (data, status, headers, config) {
$scope.response = data;
}).error(function (err) {
$scope.percent = 0;
});
} else {
$scope.add_form.submitted = true;
}
}
$scope.onFileSelect = function ($files) {
$scope.file = $files[0];
};
$scope.onVideoSelect = function ($files) {
$scope.video = $files[0];
};
错误:
IIS 8.0详细错误 - 404.13 - 未找到 请求过滤模块被配置为拒绝超过请求内容长度的请求 最可能的原因: 在Web服务器上配置请求筛选以拒绝请求,因为内容长度超过配置的值
如何解决问题?