Welcome Guest, Not a member yet? Register   Sign In
File Upload Library and special characters
#6

(This post was last modified: 11-08-2018, 01:12 AM by marwin.)

They used fileinput version 4.3.1

This is how its loaded in the view:

<script>
$(document).ready(function() {

// Fileupload
$("#fileupload").fileinput({
language: 'de',
uploadUrl: '<?php echo $this->config->base_url(); ?>contact/fileupload',
overwriteInitial: false,
showUpload: false,
showClose: false,
dropZoneEnabled: false,
allowedPreviewTypes: ['image'],
<?php if ( ! empty($files)) { ?>
initialPreview: <?php echo json_encode($file_previews); ?>,
<?php } ?>
slugCallback: function(filename) {
return filename.replace('(', '_').replace(']', '_').toLowerCase();
}
}).on("filebatchselected", function(event, files) { $("#fileupload").fileinput("upload");});

// File uploaded
$('#fileupload').on('fileuploaded', function(event, data) {
if (data.response.file_name != null)
{
// Success
console.log(data.response);
// Append input hidden
$("#contact").append('<input data-name="'+data.response.file_name_unreplaced+'" type="hidden" value="'+data.response.file_name+'" name="userfile[]">');
}
});

// File deleted
$('#fileupload').on('filesuccessremove', function(event, id)
{
// Get parent element
var file_name_unreplaced = $('#' + id).children('img').attr('title');

// Remove hidden input
$('input[data-name="'+file_name_unreplaced+'"]').remove();
});
});
</script>

Files are uploaded through <input class="form-control" type="file" id="fileupload" name="userfile[]" value="" multiple>

I cant see anywhere where I could (or should) define UTF-8 again. The locale is set to German but obviously that only affects the icon-names.

What confuses me is that the names are properly read and refered to in the admin mail. They are just stored wrongly on the server in ISO for some reason.

The header of the page in question is set correctly:

<!DOCTYPE html>
<html lang="de">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Reply


Messages In This Thread
RE: File Upload Library and special characters - by marwin - 11-08-2018, 12:54 AM



Theme © iAndrew 2016 - Forum software by © MyBB