English 中文(简体)
为什么我的麻风病档案库不能正确工作?
原标题:Why my ajax file uploader does not work correctly?

I m试图制造一个jax文档上载模块。 请参看以下法典,

//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;
};
  1. 为什么会发生 *** 我有安全错误:《安全错误守则》:“1000?

  2. 为什么我无法将新编的“投入——档案输入新制作的表格[3],甚至把新版的“投入——档案装入旧格式”(12)?

感谢。

最佳回答

你试图掩盖整个文件,这是毫无意义的。 你们需要的是:

var new_input_file = input_file.cloneNode(true);

无论如何,输入类型文档的<代码> 数值/代码”仅因明显的安全原因阅读,因此,“超结果”的唯一途径是增加新形式的实际投入:

form.appendChild(input_file);

档案应予保存。 (Didn t test it)

问题回答

您能否利用jquery操纵OM ?

var input = $( <input> ); // create your element
input.append($( #userfile ).clone()); // append something




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签