123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- var osshost = '';
- function WebUploadJs(tagId, path, resize, size, func) {
- var max_size = size.max_file_size / 1024;
- var resize_json = JSON.stringify(resize);
- if (resize.width == 0 && resize.height == 0 && resize.quality == 0) {
- upload.render({
- elem: '#' + tagId.replace('Btn', '') + 'Btn',
- url: '/Api/PublicMethod/LayUIUpload',
- data: {
- Path: path
- },
- multiple: false,
- accept: 'file',
- exts: 'doc|docx|xls|xlsx',
- size: max_size.toFixed(2),
- before: function (obj) {
- obj.preview(function (index, file, result) {
- // func(result);
- });
- },
- done: function (res) {
- func(res.data);
- }
- });
- } else {
- upload.render({
- elem: '#' + tagId.replace('Btn', '') + 'Btn',
- url: '/Api/PublicMethod/LayUIUpload',
- data: {
- Path: path,
- Resize: resize_json
- },
- multiple: false,
- size: max_size.toFixed(2),
- before: function (obj) {
- obj.preview(function (index, file, result) {
- // func(result);
- });
- },
- done: function (res) {
- func(res.data);
- }
- });
- }
- }
|