Open Bug 1265603 Opened 4 years ago Updated 4 years ago

RFE: A mechanism to recover from failure of FileReader.readAsText(HTML_FORM_INPUT.files[0]) after file got modified.

Categories

(Core :: DOM: Core & HTML, enhancement)

enhancement
Not set

Tracking

()

Tracking Status
firefox48 --- affected

People

(Reporter: BijuMailList, Unassigned)

References

Details

See Bug 1260606 comment #28
> I think we could return a different File object from
> HTMLInputElement.files[0] if the file changed on disk.

If a file was modified after it was selected using INPUT[type=file], from Firefox 45 build FileReader.readAsText(HTML_FORM_INPUT.files[0]) fails.
JavaScript developer need a mechanism to recover from such a failure.
See Also: → 1264371
My proposal here is that when a file changes, that we make inputElement.files[0] return a new File object which is updated to contain the new metadata.
So, basically when the FileReader fails, we have to go back to the HTMLInputElement.files and try again.
The only strange thing is that .files attribute changes value without having any event to inform about it.
If by "we" you mean the web developer, then yes, that's my proposal.
I want add one more situation, there will also case where file was deleted from the disk or there is network fault (if file was network, or on removable disk) after user selected it with FORM_INPUT file control.
See Also: → 1265602
You need to log in before you can comment on or make changes to this bug.