I am creating an internal web application that allows the user to upload a file through a file input element as follows:
<input class="WebFormControls" type="file" accept=".csv" id="fileBulkCsv" name="fileBulkCsv" onchange="javascript:OnFileUploadChange();" />
Problem
My problem is that client SOE uses IE8 (boo hiss, yes I know). Unfortunately, this version of IE does not support the accept attribute of the input element in combination with type = "file" (works fine in Chrome).
Question
My question is: is there any other way to reproduce this behavior? My goal is for the browser to open a file dialog that is preconfigured to filter only in CSV files.
I tried using both types of extension pattern (".csv") and MIME type ("text / csv"), but it does not work, and I suspect that IE8 just does not handle the accept attribute.
Out of range
Please note that I completely agree with the concept of using JavaScript to verify the file name and its extension. However, this happens after the user has already selected the file to upload. I am looking for a way (if possible) to replicate accept behavior in a Microsoft browser.
Thanks!
source share