How to show FileReader load progress or loading icon?

Viewed 2761

I have a file upload control that reads TXT file and load editBox with file content. The code blow works fine for onChange event for file upload control. But it I want to show loading gif icon or hourglass icon while it's loading a large data. E.g. if I try to load 3Mb file with about 130K lines it takes few seconds to appear in inputUsers edit box and then still loading the data. While this time users are able to click other controls or close the page. So how do I show loading icon when I call reader.readAsText(file); ???

var fileUploadControl = dojo.query("[id$=':fileUploadControl']")[0];
var file = fileUploadControl.files[0];

var reader = new FileReader();
reader.onload = function(e) {
    dojo.query("[id$=':inputUsers']")[0].value = reader.result;
}
reader.readAsText(file);

NOTE: well, same happens when you copy/paste a very large text into multiline editBox. I need to show something while the list is loading

1 Answers
Related