<div class="panel-body">
    <p>
        <i class="fa fa-warning"></i>
        只能上传CSV文件。
    </p>
    <ol>
        <li>分类可以填写ID或分类名称</li>
        <li>题型可以填写题型ID或名称</li>
        <li>每一行为一题，不可以断行</li>
    </ol>

    <p><img src="<?=THEMEPATH?>/images/csv.png" width="100%" class="img-thumbnail" /> </p>

    <label for="text">导入文件</label>
    <form method="post" enctype="multipart/form-data">
    <input type="file" id="fileupload" name="file" multiple="true" class="file-loading" data-show-preview="false"/>
    </form>
</div>

<link rel="stylesheet" type="text/css" media="screen" href="<?= THEMEPATH ?>/css/fileinput.min.css"/>

<script src="<?= THEMEPATH ?>/js/fileinput.min.js"></script>
<script src="<?= THEMEPATH ?>/js/fileinput_locale_zh.js"></script>

<script type="text/javascript">
    $(function () {
        $('#fileupload').fileinput({
            language: 'zh', //设置语言
            uploadUrl: '<?= SITEPATH ?>/admin/import/upload',
            maxFileCount: 50,
            allowedFileExtensions: ['csv'],
            uploadAsync: true,
            showPreview: false,
            showCaption: true,
            showCanel: true
        });

        $('#fileupload').on('filepreupload', function(event, data, previewId, index, jqXHR) {
            ajax_dialog.close();
            show_error(data);
            $('#questionTable').DataTable().draw(false);
        });
    });
</script>

