微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

jquery多文件上传问题

如何解决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 举报,一经查实,本站将立刻删除。