Help - Search - Members - Calendar
Full Version: Can I modify what 'input type="file"' displays
HTMLHelp Forums > Programming > Client-side Scripting
REJKID
Hi,
Is there any way I can specify regular expression of what 'input type="file"' dialog box shows. What I mean by that is that I would like 'input type="file"' to display only the files that their names do match my regular expression and nothing else (e.g. 'Beacon_Suite_V1_0_10_(20180926).mot')
Is this possible?

Kind Regards,
REJKID
Christian J
I don't think that's possible, for security reasons.

Actually the ACCEPT attribute might be used for this, at least with file extensions. See https://www.w3.org/TR/html/sec-forms.html#e...ef-input-accept
REJKID
ACCEPT is only for file extension, I need a regular expression filter. I though pattern would be OK, but it works only for input types: text, date, search, url, tel, email, and password but not for file.

Kind Regards,
Janusz
Christian J
Here's a javascript property that reveals the file name, but only after the file has already been selected: https://developer.mozilla.org/en-US/docs/Web/API/File/name but I suppose you want the prefiltering done before the user selectes anything...
REJKID
Yep. I need pre-filtering done before the user selects anything. Thanks for the suggestion anyway.
Kind Regards,
Janusz
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2018 Invision Power Services, Inc.