jquery多文件上传问题

问题描述

我有一个用于添加文件的模式,但现在我想上传多个文件,下面是我的代码

$(document).ready(function(){
   $("#uploadArtWrokAttachment_model").modal();
});

$('#uploadAttachment').click(function(){
    $('#uploadArtworkAttachment').click();
});

$('#uploadArtworkAttachment').change(function(){
    var file = $('#uploadArtworkAttachment')[0].files[0].name;
    $('#attachmentName').html(file); 
});
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">

<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">



<div class="modal fade" id="uploadArtWrokAttachment_model" tabindex="-1" role="dialog"  aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content animated fadeInDown ">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Upload Artwork Attachment</h4>
            </div>
            <div class="modal-body" style="border: none;">
                <form method="post" enctype="multipart/form-data" id="artWorkAttachmentForm">
                    <div class="row">
                        <div class="col-md-6 col-md-offset-3">
                            <div class="col-md-12">
                                <div class="div-center" id="uploadAttachment">
                                    <h4>Choose from gallery</h4>
                                    <i class="fa fa-picture-o icon-size" aria-hidden="true"></i>
                                </div>
                                <input type="file" name="uploadArtworkAttachment" id="uploadArtworkAttachment" class="form-control hidden">
                            </div>
                            <br>
                            <div class="col-md-12 text-center" style="margin-top: 5%;">
                                <label for="" id="attachmentName"></label>
                            </div>
                            <br>
                            <div class="col-md-12 text-center" style="margin-top: 5%;">
                                <input type="hidden" id="attachmentOrderId" name="attachmentOrderId" value="">
                                <img id="loader" src="{{ URL::asset('image/wait.gif') }}" style="width: 8%;">&nbsp;&nbsp;
                                <button type="button" id="saveArtWorkAttachment" class="btn btn-primary">Save</button>
                                <a class="btn btn-white" onclick="$('#uploadArtWrokAttachment_model').modal('hide')" >Close</a>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

现在我想一次上传多个文件,因为我更改了输入文件uploadArtworkAttachment[]添加multiple

但我的文件仍然没有上传多个文件

有人可以帮我吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)