layer 能支持多图片上传吗?

提问 未结
3 2036
美梦一箩筐
悬赏:5飞吻
如题,我没看到相应的接口
回帖
  • SMALL
    2017-1-11
    重点是multiple 接收得就是一个集合
    <div class="site-demo-flow" id="upload-images">

    </div>
    <div class="layui-box">
    <div class="layui-upload-button"><form target="layui-upload-iframe" method="post" key="set-mine" enctype="multipart/form-data" action=""><input required type="file" name="file-demo[]" multiple class="layui-upload-file" value=""></form><span class="layui-upload-icon"><i class="layui-icon"></i>上传图片</span></div>
    </div>
    <script>
    layui.use(['form','upload', 'jquery', 'layer','flow'], function(){
    var form = layui.form(),
    $=layui.jquery,
    layer=layui.layer,
    upload=layui.upload,
    flow = layui.flow;
    layui.upload({
    url: 'http://www.90zs.net/layui/demo/upload/uploads.php?dopost=qiniu-images'
    ,unwrap:true
    ,before: function(input){
    //返回的参数item,即为当前的input DOM对象
    console.log('文件上传中');
    }
    ,success: function(res){
    for (key in res){
    if(res[key].code==0)
    $("#upload-images").append('<img lay-src="'+res[key].data.src+'" alt="'+res[key].data.name+'"/>');
    else
    layer.msg(res.msg);
    flow.lazyimg();
    }
    console.log('上传完毕');
    }
    });

    //各种基于事件的操作,下面会有进一步介绍
    });
    </script>
    0 回复
  • @SMALL 谢谢啦
    0 回复
  • @SMALL php那里怎么接收呢
    0 回复
本帖已设置禁止回复
本周热议
没有相关数据
layui

微信扫码关注 layui 公众号