调试上传逻辑

This commit is contained in:
BianLzhaoMin 2025-08-07 09:06:03 +08:00
parent f8ab0d9ebb
commit cc81fe7cec
1 changed files with 18 additions and 0 deletions

View File

@ -43,6 +43,7 @@ layui.use(["table", "form", "upload", "tree"], function () {
$("#uploadBtn").on("click", function () {
$("#fileInput").click();
});
// 让点击上传按钮触发文件输入框的点击事件
$("#uploadBtn1").on("click", function () {
$("#fileInput1").click();
@ -86,6 +87,23 @@ layui.use(["table", "form", "upload", "tree"], function () {
} else {
$("#fileInfo1").html("选中的文件:" + fileName);
}
const formData = new FormData();
formData.append("file", file);
$.ajax({
url: ctxPath + "/organizational/uploadInfo",
type: "POST",
data: formData,
processData: false, // 告诉jQuery不要处理数据
contentType: false,
success: function (res) {
console.log(res, "上传成功");
},
error: function (err) {
console.error(err);
},
});
});
// 初始化下拉框
getOutSourceSelected();