Error: No suitable file reader found on Drag and Drop Audio Files
CodeZeke123 opened this issue · comments
CodeZeke123 commented
hi! i have a problem reading about files in javascript on drag and drop and it say "Error: No suitable file reader found"
`var jsmediatags = window.jsmediatags
$(document).ready(function() {
var UploadAudioArea= $('#UploadAudioArea')
UploadAudioArea.on('drop', function(e) {
e.preventDefault()
new jsmediatags.read(e.originalEvent.dataTransfer.files[0].name, {
onSuccess: function(tag) {
var tags = tag.tags
console.log(tags.artist + " - " + tags.title + ", " + tags.album)
},
onError: function(error) {
console.log(':(', error.type, error.info);
}
})
})
UploadAudioArea.on('dragover', function(e) {
return false
})
UploadAudioArea.on('dragleave', function(e) {
return false
})
})`
António Afonso commented
You need to pass the file object, not the name:
new jsmediatags.read(e.originalEvent.dataTransfer.files[0], {