我使用此脚本https://github.com/danialfarid/angular-file-upload在AJAX ft.angularJS上传文件时出现两天错误。 但是在我选择要上传的文件之后,我有一个TypeError:
TypeError:无法执行'追加' on' FormData':找不到与提供的签名相匹配的功能。 在TypeError(本机)
at upload (http://localhost:8888/angular-file-upload.min.js:2:1609)
at h.$scope.onFileSelect (http://localhost/UploadCtrl.js:31:29)
at http://localhost/angular.min.js:166:92
at http://localhost/angular-file-upload.min.js:2:1991
at http://localhost/angular.min.js:115:185
at e (http://localhost:8888/angular.min.js:33:421)
at http://localhost:8888/angular.min.js:37:77
如果我使用其他浏览器,如Firefox,Safari,Opera,甚至IE,都可以正常工作..
感谢您的帮助。
答案 0 :(得分:1)
Angular期望上传的文件能够实现Blob接口。
https://developer.mozilla.org/en-US/docs/Web/API/Blob
我在Jasmine测试中遇到此错误,并通过创建这样的新Blob来解决它。
var file = new Blob();