I have a form with ajax file uploading. Javascript creates iframe with a form, moves input with the file into the form and submit the form.
This works without any problem, but popular NoScript plugin in Firefox thinks that it's XSS and turn my POST request into GET. So it doesn't work. Is there any possibility to circumvent this problem?
Code (uses jQuery)
function add_input_file(div) {
var input = $("<input>").attr("type", "file").attr("name", "file");
input.appendTo(div);
input.change(function() {
$(this).off();
var iframe = $("<iframe>");
iframe.appendTo($("body"));
iframe.load(function() {
$(this).off();
var input = $(this).data("input");
var form = $("<form>").attr("method", "post").attr("action", "/send").attr("enctype", "multipart/form-data").attr("accept-charset", "UTF-8");
form.appendTo($(this).contents().find("body"));
input.appendTo(form);
add_input_file($("#att"));
form.submit();
});
});
}
$(function() {
add_input_file($("#att"));
})