有没有什么办法与XMLHtt prequest对象发送二进制数据? [英] Is there any way to send binary data with XMLHttpRequest object?
问题描述
我'尝试发送二进制块与XMLHtt prequest
I'am trying to send binary chunk with XMLHttpRequest
var xhr = new XMLHttpRequest();
var bindata = 0x0f0f;
xhr.open("POST", "binary_reader.php");
xhr.send(bindata);
但这种方法不能工作。我试图提供内容类型:应用程序/八位字节流,内容编码 对于 XHR头,他们没有任何工作。我很怀疑,有没有办法来编写这样那样的要求。
But this approach not works. I've tried to provide Content-type: application/octet-stream, Content-encoding headers for xhr and they don't work either. I am suspect that there is no way to compose request of such kind.
我想AP preciate任何帮助。
I would appreciate any help.
推荐答案
在最新规范。目前我还没有看到任何实施至今,但在不久的将来,这绝对是与XMLHtt prequest下载和上传的二进制数据的方式。
W3C has introduced Blob type to XMLHttpRequest in the latest specification. Currently I haven't seen any implementation so far but in near future this is definitely the way to download and upload binary data with XMLHttpRequest.
这篇关于有没有什么办法与XMLHtt prequest对象发送二进制数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!