我正在使用fineuploader 和codeigniter。为了使上传更安全,我想通过在配置中启用它来使用 codeigniter 提供的 CSRF 保护。现在,当使用 codeigniter 的表单助手时,它会自动在表单中添加一个隐藏字段。
但是,我不知道如何使用fineuploader 实现这一点,因为我在这里没有可见的表单。有小费吗?
<script>
$(document).ready(function () {
$('#bootstrapped-fine-uploader').fineUploader({
request: {
endpoint: "<?= site_url('upload/doUpload') ?>",
params: {"generateError": true}
},
chunking: {
enabled: true
},
debug: true,
text: {
uploadButton: '<div><i class="icon-upload icon-white"></i> Datei auswählen</div>'
},
template: '<div class="qq-uploader span12">' +
'<pre class="qq-upload-drop-area span12"><span>{dragZoneText}</span></pre>' +
'<div class="qq-upload-button btn btn-success">{uploadButtonText}</div>' +
'<span class="qq-drop-processing"><span>{dropProcessingText}</span><span class="qq-drop-processing-spinner"></span></span>' +
'<ul class="qq-upload-list" style="margin-top: 10px; text-align: center;"></ul>' +
'</div>',
validation: {
allowedExtensions: [],
sizeLimit: 1000 * 1000 * 800
},
showMessage: function(message) {
// Using Twitter Bootstrap's classes and jQuery selector and method
$('.qq-upload-list').append('<li class="alert alert-error">' + message + '</li>');
},
failedUploadTextDisplay: {
mode: 'custom',
maxChars: 100,
responseProperty: 'error',
enableTooltip: true
},
classes: {
success: 'alert alert-success',
fail: 'alert alert-error'
},
retry: {
enableAuto: false
}
});
});