简体   繁体   English

单个文件实例多次上传

[英]Multiple uploads with single file instance

I have a file upload page which is to upload multiple files at a time. 我有一个文件上传页面,该页面可以一次上传多个文件。 Suppose if i upload 3 files following 4 files uploaded next with file input, at this time first 3 file items are removing from file instance. 假设如果我在上传文件后接下来上传了4个文件之后上传了3个文件,则此时前3个文件项正在从文件实例中删除。

When i uploading all the selected files to server it is receiving the last 4 file items only first uploaded file items are removed. 当我将所有选定的文件上传到服务器时,它接收的是最后4个文件项,仅删除第一个上传的文件项。

Could any one please help how to upload files using multiple file uploads with single file instance? 请问有人可以帮助如何通过单个文件实例使用多个文件上传来上传文件吗?

Here is the code i have used to get the file properties, I am calling a function addFiles on change event of fileinput button. 这是我用来获取文件属性的代码,我在fileinput按钮的change事件上调用addFiles函数。

function addFiles(evt) {
    var eventReference = (typeof evt !== "undefined")? evt : window.event;
    if (eventReference.preventDefault) { 
        eventReference.preventDefault();
    } 
    var eventTarget =eventReference.dataTransfer;
    files=eventTarget.files; 
    for (var i = 0; file = files[i]; i++) {
        //getting the content from file and adding to table
    }
}

You can check out this plugin. 您可以签出此插件。 I'm sure you will get what you want 我相信你会得到你想要的

I've used this in many project. 我已经在许多项目中使用了它。 Give a try to check to suit your requirement. 尝试检查以适应您的要求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM