Re: Import CSV, version 2.7.2
Reply #7 –
OK, to be able to use Import Data modal dialog, all you need is to change html helper, Html.php by adding following line into form:
<input type="hidden" name="csrf_token" value="<?php echo Csrf::$token; ?>" />
for example lines from 373 to 391 should look like this:
<form method="post" action="<?php print_link($form_path) ?>" enctype="multipart/form-data" id="-import-data" class="modal fade" role="dialog" tabindex="-1" data-backdrop="false" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog modal-dialog-centered modal-sm">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Import Data</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<label>Select a file to import <input required="required" class="form-control form-control-sm" type="file" name="file" /> </label>
<small class="text-muted">Supported file types(csv , json)</small>
<input type="hidden" name="csrf_token" value="<?php echo Csrf::$token; ?>" />
</div>
<div class="modal-footer">
<button type="reset" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Import Data</button>
</div>
</div>
</div>
</form>
Line 383 is added into form.
Vladimir