I am trying to excel(.xls) file upload with krajee bootstrap file upload but it seems only accept image files.
Here is My Javascript Codes:
$("#dosyalar").fileinput({
uploadUrl: "ajax/upload_files.php",
uploadAsync: true,
previewFileType:'any',
language:"tr",
uploadExtraData: function() {
return { donem: $('#donem').val() };
}
}).on('filebatchuploaderror', function(event, data, previewId, index) {
var form = data.form,
files = data.files,
extra = data.extra,
response = data.response,
reader = data.reader;
console.log(response);
}).on('filebatchuploadsuccess', function(event, data, previewId, index) {
var form = data.form,
files = data.files,
extra = data.extra,
response = data.response,
reader = data.reader;
alert (extra.bdInteli + " " + response.uploaded);
console.log(response);
});
Here PHP Codes For Test:
// upload.php
// 'images' refers to your file input name attribute
if (empty($_FILES['dosyalar'])) {
echo json_encode(['error'=>'No files found for upload.']);
// or you can throw an exception
return; // terminate
}
When try to upload batch excel files every time it says No files found for upload
.It seems doesnt accept .xls extension.
How can I upload excel files using with this plugin?
Thanks
Did you specify extension ? allowedFileExtensions : ['jpg', 'png','gif', 'xlsx']