layui 上传文件时 参数

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/farmwang/article/details/81938015
   function getuploaddata() {
            console.log("getuploaddata");
            var json = {
                "ASPSESSID": "hh", "ActionName": "MultiFile", "folder": "QMS", "subfolder": "", "sysid": "WebChart", "form_id": "xxx",
                "path": "ftp://www.qmtec.net/kaFastFlow/Flow/18081121524585016", "waterWords": "N",
                "form_type": "888888",
                "location": "Item",
                "operation": "op",
                "level": 8,
                "memo": $('#txtfiledesc').val(),
                "lot": "lot",
                "item_id": "item",
                "item_desc": "name",
                "user_id": "user",
                "user_name": "username",
                "vendor": "vendor",
                "status": "New",
                "trx_id": "trxid",
                "info": "info",
                "authority": "user"
            }
            return json;
        }
       
        layui.use('upload', function () {
            var $ = layui.jquery
                , upload = layui.upload;

            //普通图片上传
            var uploadInst = upload.render({
                elem: '#op1uplload'
                , method: "post"
               
                , url: 'http://localhost/WorkFlow/httpserver/formftp.ashx'
                , multiple: true
                , accept: 'file' //普通文件
                , before: function (obj) {
                    //预读本地文件示例,不支持ie8
                    this.data = getuploaddata();
                    layer.load(); //上传loading
                }
                , done: function (res) {
                    layer.closeAll('loading'); //关闭loading
                    if (res.code == "000") {
                        //do something (比如将res返回的图片链接保存到表单的隐藏域)


                        layer.msg('上传成功');

                    }
                    else {

                        layer.msg("上传失败  " + res.msg);
                    }
                }
                , error: function () {
                    layer.closeAll('loading'); //关闭loading
                    layer.msg('上传失败');
                }
            });

        });
    </script>

猜你喜欢

转载自blog.csdn.net/farmwang/article/details/81938015