私はajaxファイルアップロードモジュールを作成しようとしています。場所で[1]私はあなたが参照元を与えることができる、セキュリティエラーSecurity error" code: "1000
を取得する必要があり、なぜ、次のコードスニペットでなぜ私のajaxファイルアップローダが正しく動作しないのですか?
//create the form for uploading the file the ajax file
FileUploader.prototype.createForm = function() {
// create the new form
var form = document.createElement('form');
form.id = this.form_id;
form.action = this.url;
form.method = 'post';
form.enctype = 'multipart/form-data';
form.target = 'file_upload_iframe';
// try to create a file type of input failed at [1]
/* var input_file = document.createElement('input');
input_file.type = 'file';
input_file.name = this.name;
input_file.value = this.file; [1] */
// try to clone the input file but failed to insert it to the old form[2]
// or the new form [3] either
var input_file = document.getElementById('userfile');
var new_input_file = document.cloneNode(true);
// document.getElementById('file_upload').appendChild(new_input_file); [2]
new_input_file.id = '';
form.appendChild(new_input_file); // [3]
document.body.appendChild(form);
return form;
};
を見てください?
私はnew_input_fileを新しい作成されたフォーム[3]に追加したり、新しいクローンnew_input_fileを古いフォーム([2])に追加することができませんでしたか?
ありがとう。
ありがとう。ああ、私はコードを再チェックすべきです、実際には** input_file **だと思っていましたが、存在しない答えを見つけるのに30分を記録して投資していません。 – Jichao
@ Jic歓声、時にはあなたが必要とするのは目の新鮮なセットです。 :) –
約8時間私のノートブックの前に置いた後....私の頭が台無しにされている...:) – Jichao