前端代码如下:
<form action="" id="uploadExcel" method='GET'>
<input type="file" name="file" id="uploadFile" style="display: none;">
<input type="submit" value="查询" class="cx_submit" />
</form>
$("#uploadFile").change(function() {
var filePath = $(this).val();
if (filePath.indexOf("xls") != -1 || filePath.indexOf("xlsx") != -1) {
const file = document.getElementById('uploadFile').files[0];
const formData = new FormData();
formData.append('file', file);
$.ajax({
headers:{
"token": $("#token").val(),
},
type: 'POST',
url: $("#knowledgeUrl").val()+'admin-recite/recite/import',
data: formData,
contentType: false,
processData: false,
success: function (data) {