MK *_*ung 0 javascript xmlhttprequest dropzone.js
我正在尝试将我的照片与参数中发送的标签(逗号分隔的字符串)一起上传tagname
.
sending
传递给Dropzone.JS 的选项允许我在发送请求之前获取XHR对象.
Dropzone.options.uploadDropzone({
// ...
sending: function(file, xhr, formData){
// but how to add my tags string to the params?
// any methods like setting the header:
// xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest")?
}
})
Run Code Online (Sandbox Code Playgroud)
小智 5
在javascript中
var xhr = new XMLHttpRequest();
xhr.open("POST", "FileUploadHandler.ashx");
var fd = new FormData();
fd.append("sFileTitle", document.getElementById('txtFileTitle').value);
xhr.send(fd);
Run Code Online (Sandbox Code Playgroud)
因此,您可以使用键和值对在表单数据中附加数据
var fd = new FormData();
fd.append("sFileTitle", document.getElementById('txtFileTitle').value);
Dropzone.options.uploadDropzone({
// ...
sending: function(file, xhr, fd){
// but how to add my tags string to the params?
// any methods like setting the header:
// xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest")?
}
})
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5325 次 |
最近记录: |