質問

I am trying to upload my photos together with tags (a comma delimited string) sent in an argument tagname.

The sending option passed to the Dropzone.JS allows me to get the XHR object before sending the request.

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")?
    }
})
役に立ちましたか?

解決

in javascript

    var xhr = new XMLHttpRequest();
    xhr.open("POST", "FileUploadHandler.ashx");
    var fd = new FormData();
    fd.append("sFileTitle", document.getElementById('txtFileTitle').value);

    xhr.send(fd);

so you would append data in form data using key and values pair

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")?
        }
    })
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top