Accept attribute in file input for IE8

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!

+4
source share
1 answer

The only way to achieve this is to use an external bootloader in flash or in java (applet)

You can use, for example, swfupload: https://code.google.com/p/swfupload/

Unfortunately, the verification file type is in the html5 api, which is not supported by IE8

+8
source

Source: https://habr.com/ru/post/1485733/


All Articles