我试图上传我的照片连同标签(一个逗号分隔字符串)在一个参数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")?
}
})发布于 2013-12-20 10:00:32
在javascript
var xhr = new XMLHttpRequest();
xhr.open("POST", "FileUploadHandler.ashx");
var fd = new FormData();
fd.append("sFileTitle", document.getElementById('txtFileTitle').value);
xhr.send(fd);因此,您可以使用键和值对在表单数据中追加数据。
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")?
}
})https://stackoverflow.com/questions/20700818
复制相似问题