Add Dynamic File upload field using ajax

Add Dynamic File upload field using ajax

by winstrong selvakumar -
Number of replies: 0

Hai,

* I put in Course edit page,

    $mform->addElement('button', 'add', get_string('add'),array('onclick'=>"calling();"));

    $mform->addElement('file', 'fileupload_0',  get_string('uploadafile'));

 

* In ajax page for example,

    <input id="id_fileupload_1 " name="fileupload_1 " type="file"/>

    using this code (document.getElementById("divno").innerHTML=xmlhttp.responseText;) i cant    get the value,Its Shows incorrect upload attempt ..

 

* how can i use $mform->addElement('file', 'fileupload_1',  get_string('uploadafile')); instead of

   <input id="id_fileupload_1 " name="fileupload_1 " type="file"/>...

 

* In individual page,how can i display file upload field alone..what headers i need to include..

  can any one help me please with detail code..!

Average of ratings: -