let file = $('#uploadImg')[0].files[0]
let form = new FormData()
form.append('files', $('#uploadImg')[0].files[0])
admin.req({
url: xxx,
type: 'POST',
data: form,
processData: false,
contentType: false, // 告诉ajax不要处理数据格式
done: function (res) {
console.log(res);
$('#Avctor').attr('src', res.url)
$('#Avctor').show()
$('#uploadImgBtntxt').html('更改头像')
}
})
02-22
7757
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
10-10
809
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
11-08
903
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
11-26
9449
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
12-20
379
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)