admin管理员组文章数量:1425815
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:
myBlob: Blob
size: 341746
type: "text/plain"
But it is not being appended to the FormData
:
Why is the Blob
not showing up in the 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:
myBlob: Blob
size: 341746
type: "text/plain"
But it is not being appended to the FormData
:
Why is the Blob
not showing up in the FormData
?
-
fd.append('clip', myBlob, 'blobby.txt');
By the way, localStorage properties cast to Strings when possible. – StackSlave Commented Jul 28, 2020 at 20:31 -
@StackSlave I just copied and pasted incorrectly from my code : that was actually there .. Corrected the question to show it. What is the importance of your
localStorage
/ strings ment? – WestCoastProjects Commented Jul 28, 2020 at 20:34
1 Answer
Reset to default 4Well, actually, according to FormData specs, there is no way to inspect form data elements within a simple console.log()
or debugger.
So the only way to inspect the items within it is to iterate through 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]);
}
本文标签: javascriptHow to append a Blob to FormDataStack Overflow
版权声明:本文标题:javascript - How to append a Blob to FormData - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745421228a2657907.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论