[英]How to append a Blob to FormData
var myBlob = new Blob(["This is my blob content"], {type : "text/plain"});
var fd = new FormData();
fd.append("clip",myBlob)
The Blob
is working fine: Blob
工作正常:
myBlob: Blob
size: 341746
type: "text/plain"
But it is not being appended to the FormData
:但它没有被附加到
FormData
:
Why is the Blob
not showing up in the FormData
?为什么
Blob
没有出现在FormData
中?
Well, actually, according to FormData specs there is no way to inspect form data elements within a simple console.log()
or debugger.好吧,实际上,根据FormData规范,无法在简单的
console.log()
或调试器中检查表单数据元素。
So the only way to inspect the items within it is to iterate throught its entires like this:因此,检查其中项目的唯一方法是像这样遍历整个项目:
var myBlob = new Blob(["This is my blob content"], {type : "text/plain"});
var fd = new FormData();
fd.append("clip",myBlob);
// Display the key/value pairs
for (var pair of fd.entries()) {
console.log(pair[0]+ ', ' + pair[1]);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.