gpt4 book ai didi

javascript - 如何使用 ajax 、 jquery 和 spring mvc 上传文件和数据

转载 作者:行者123 更新时间:2023-11-28 05:45:44 25 4
gpt4 key购买 nike

我想使用 ajax、查询和 Spring MVC 上传数据和文件,下面是我的模式弹出窗口。请谁能帮我解决这个问题。

<!-- Modal -->
<div id="fileUpload" class="modal fade" role="dialog">
<div class="modal-dialog">

<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>

<h4 class="modal-title" id="changeTitle">
<spring:message code="ulearn.summary.mastercourse.addreference" />
</h4>
</div>

<div class="modal-body">
<form class="form-horizontal" role="form" id="masterCourseItemForm" onsubmit="return false;">
<div class="form-group">
<label class="control-label col-sm-2" for="name"><spring:message code="ulearn.summary.name.label"/></label>

<div class="col-sm-10">
<input type="text" class="form-control" id="name" placeholder="" value="" autofocus="true">
</div>
</div>

<div class="form-group">
<label class="control-label col-sm-2" for="pwd"><spring:message code="ulearn.summary.description.label"/></label>

<div class="col-sm-10">
<textarea type="text" class="form-control" id="description" placeholder="" value=""></textarea>
</div>
</div>

<div class="form-group">
<label class="control-label col-sm-2" for="pwd">File Type</label>

<div class="col-sm-10">
<select name="Select" class="selectpicker form-control" id="stateLst">
<option value="">Select</option>

<c:forEach items="${fileList}" var="option">
<option value="${option}">
<c:out value="${option}"></c:out>
</option>
</c:forEach>
</select>
</div>
</div>

<div class="form-group">
<label class="control-label col-sm-2" for="pwd">Upload</label>

<div class="col-sm-10">
<div class="fileinput fileinput-new" data-provides="fileinput">
<span class="btn btn-default btn-file" style="width: 468px;"><span>Choose file</span><input type="file" multiple/></span>
</div>
</div>
</div>

<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="button" class="btn btn-primary" id="submit" data- backdrop="static">
<spring:messagecode="ulearn.btn.upload.label"/>
</button>

<button type="button" class="btn btn-primary" data-dismiss="modal"> <spring:messagecode="ulearn.btn.cancel.label"/>
</button>
</div>
</div>

</div>

</form>

</div>
</div>
</div>

</div>

最佳答案

您可能想查看 multipart/form-data 帖子。以下是有关该主题的一些附加信息:

http://hmkcode.com/spring-mvc-upload-file-ajax-jquery-formdata/

Upload file + Form Data + Spring MVC + JQuery

关于javascript - 如何使用 ajax 、 jquery 和 spring mvc 上传文件和数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38541561/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com