react-csv-reader
react-csv-reader copied to clipboard
is it possible to run onFileLoaded when I am manually adding the file using drop event
I am manually adding the file using Drag and Drop API, on the drop I am pointing the file to the input field but this doesn't trigger the onFileLoaded. Code sample (this isn't the real react code) to manually adding the file using drop event:
function handleDroppedFile(evt) {
evt.preventDefault();
// since we use jQuery we need to grab the originalEvent
var dT = evt.originalEvent.dataTransfer;
var files = dT.files;
if (files && files.length) {
// we set our input's 'files' property
$('#image-event')[0].files = files;
}
}
$('#image-event-label').on({
'drop': handleDroppedFile
})
<label for="image-event" id="image-event-label">
Drop a file here
</label>
<input type="file" name="image-event" id="image-event">