[SalesForce] How to access the FileList array for file inputs in Lightning Components with LockerService

I have been experimenting with LockerService and found that the files array that should be available in JavaScript for file input types is not available when LockerService is enabled.

Component Markup

<input type="file"
    aura:id="file"
    class="slds-button slds-button--brand"
    onchange="{!c.handleFileChange}" />
<ui:outputText aura:id="buttonText" value="Select File"/>

Component JS

var fileComp = component.find("file");
var file = fileComp.getElement().files[0]; // files is undefined

Note that the value attribute is available. It is just the files array that is not.

Is there an alternative way to get at the file? If not, is this something that will be supported eventually?

The Salesforce Lightning CLI did not report the files array as an error.

Best Answer

Peter, files is not part of the whitelist of attributes that can be inspected from a secure DOM element. Just open a case for this, and we can get it exposed.