<script type="text/javascript">
//使用layui上传图片
layui.use('upload', function () {
var upload = layui.upload;
var layer = layui.layer;
//执行实例
var uploadInst = upload.render({
elem: '#isTest', //绑定元素
url: '/upload/', //上传接口
accept: 'images',
auto: false,
choose: function (obj) { //选择文件后的回调
var files = obj.pushFile();
var filesArry = [];
for (var key in files) { //将上传的文件转为数组形式
filesArry.push(files[key])
}
var index = filesArry.length - 1;
var file = filesArry[index]; //获取最后选择的图片,即处理多选情况
if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1]
.replace(/[ ]/g, "").replace("MSIE", "")) < 9) {
return obj.upload(index, file)
UEditor上传图片
最新推荐文章于 2024-06-26 13:30:13 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)