Browser Specific issue - One input file field data not assign to another input file field

我只是一个虾纸丫 提交于 2019-12-11 17:32:00

问题


function assignFile(obj){
     var file2 = document.querySelector('#fileData');
     file2.files = obj.files;
     console.log(file2.files);
}
   
<form action="" method="post" enctype="multipart/form-data">
    <input type="file" name="fileData[]" id="fileData" multiple="" style="display: none;" />
    File: <input type="file" id="file" name="file" onchange="assignFile(this)" />
    <input type="submit" name="submit" value="Submit" />
</form>

I have two file fields. I want to assign file data to fileData field. I have posted my code. This code working fine in chrome. But not working in mozilla. Could you please check.

来源:https://stackoverflow.com/questions/46440430/browser-specific-issue-one-input-file-field-data-not-assign-to-another-input-f

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!