Hello.
In the form I need to upload a CSV file to the site.
How to prevent users from loading files of other formats into this form?
accept="text/csv" Or is some other MME type correct for this format? Or is it possible to do something with javascript?
Thank.
UPD There is such a code
var filesExt = ['csv']; $('input[type=file]').change(function(){ var parts = $(this).val().split('.'); if(filesExt.join().search(parts[parts.length - 1]) == -1){ alert('Не совпадает формат файла'); } }); Tell me, please, how, after the alert, add more and clear this file field?