发布:2023/2/10 23:40:32作者:管理员 来源:本站 浏览次数:603
html
文件名:<input type="text" name="filename" />
文件: <input type="file" name="my_file" />
ajax
UploadImg:function(){
var formData = new FormData($("#form_avatar")[0]);
$.ajax({
url: "/Privacy/UploadUserImg",
type: "POST",
headers: { "Authorization": 'Bearer ' + token },
data: formData,
contentType: false,
processData: false,
success: function (data) {
console.log(data);
if(data.success){
$('#head-view').attr('src',data.response);
}
},
error: function (e) {
console.log("系统出错!");
console.log(e.error);
}
});
}
MVC后端
/// <summary>
/// 上传文件© Copyright 2014 - 2024 柏港建站平台 ejk5.com. 渝ICP备16000791号-4