2
我有一个窗体有一个文件输入元素,当用户选择文件我想设置选定的文件到另一个文件输入是隐藏的IFRAME,如何克隆文件输入到另一个文件输入是在隐藏iframe
这就是我的方式:
<form name="uploadForm" >
<input type="file" id="fileone" name="fileone" value="" />
<button type="button" id="attachement_upload" onclick="addFile()" >Upload</button>
</form>
<iframe id="FileUploadFrame" name="FileUploadFrame" src="" style="display: none; border: 0; width: 0; height: 0;">
<form id="FileUploadForm" name="FileUploadForm" accept-charset="utf-8" target="FileUploadFrame" enctype="multipart/form-data" encoding="multipart/form-data" method="POST" action="CIMtrek_Regional_WhseForm_FileUpload">
<input type="file" id="filetwo" name="filetwo" value="" />
</form>
</iframe>
和我的Java脚本:
function addFile(){
//this is where i want to clone the fileone to filetwo and submit the form which is in iframe
}
我看到一些像这样的事情,但真的不知道该怎么办:
$(".inputfield1").change(function(){
var $this = $(this), $clone = $this.clone();
$this.after(clone).appendTo(hiddenform);
});
请帮我完成这件事。