Restangular:上传多部分表单会导致发送错误

时间:2014-06-30 18:37:50

标签: javascript angularjs restangular

我尝试使用restangular.js上传文件作为多部分表单的一部分。

这是我得到的错误

XPCWrappedNative_NoHelper { message: "JavaScript component does not have a method named: "available"'JavaScript component does not have a method named: "available"' when calling method: [nsIInputStream::available]", result: 2153185328, name: "NS_ERROR_XPC_JSOBJECT_HAS_NO_FUNCTION_NAMED", filename: "https://ajax.googleapis.com/ajax/libs/angularjs/1.2.17/angular.js", lineNumber: 8407, columnNumber: 0, location: XPCWrappedNative_NoHelper, inner: null, data: null } angular.js:9899
XPCWrappedNative_NoHelper { message: "JavaScript component does not have a method named: "available"'JavaScript component does not have a method named: "available"' when calling method: [nsIInputStream::available]", result: 2153185328, name: "NS_ERROR_XPC_JSOBJECT_HAS_NO_FUNCTION_NAMED", filename: "https://ajax.googleapis.com/ajax/libs/angularjs/1.2.17/angular.js", lineNumber: 8407, columnNumber: 0, location: XPCWrappedNative_NoHelper, inner: null, data: null }

这是我发送对象的代码:

$rootScope.objects.user.withHttpConfig({
    transformRequest: angular.identity
    },
}).customPUT($scope.objects.user, "", { // I've tried regular `put` as well
    'Content-Type': undefined
}).then(function(resp) {
    if (resp == "OK") {
        $scope.successes = [{
            msg: "Saved"
        }];
    }
}, function(err) {
    console.log(err);
    $scope.errors = err.data.errors;
});

user对象包含以下内容:

{
   username: "...",
   email: "...",
   profilePicture: [File] // What makes this complicated
}

0 个答案:

没有答案