i am trying to use angular file upload to filter and make user upload kml files only (map) . i have a working code where i use picture files
this.uploader.filters.push({
name: 'imageFilter',
fn: (item, options) => {
var type = '|' + item.type.slice(item.type.lastIndexOf('/') +
1) + '|';
return '|jpg|png|jpeg|bmp|gif|'.indexOf(type) !== -1;
}
});
simply putting |kml| with other or just by itself is not working. any solutions?
i saw an example of xml file also here it is
function xmlFilter(file) {
var validMimeTypes = ['application/xml', 'text/xml'];
if (validMimeTypes.indexOf(file.type) !== -1) {
return true;
}
}
this.uploader.filters.push({name: 'xmlFilter', fn: xmlFilter});
}