使用上傳外掛
html
<a href="javascript:;" class="btn btn-danger btn-stock-file" id="btn-stock-file" title="複製出來的匯入按鈕" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> 複製出來的匯入按鈕</a>\
js
require(['upload'], function (Upload) {
Upload.api.plupload($("#btn-stock-file"), function (data, ret) {
Fast.api.ajax({
url: '/admin/bluewhale/Attr/import',
data: {file: data.url},
}, function (data, ret) {
table1.bootstrapTable('refresh');
},function (data, ret) {
table1.bootstrapTable('refresh');
});
});
});