The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Can I modify what 'input type="file"' displays
REJKID
post Sep 26 2018, 05:29 AM
Post #1





Group: Members
Posts: 3
Joined: 26-September 18
Member No.: 26,718



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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Sep 26 2018, 11:41 AM
Post #2


.
********

Group: WDG Moderators
Posts: 7,946
Joined: 10-August 06
Member No.: 7



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

This post has been edited by Christian J: Sep 26 2018, 12:54 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
REJKID
post Sep 27 2018, 06:06 PM
Post #3





Group: Members
Posts: 3
Joined: 26-September 18
Member No.: 26,718



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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Sep 28 2018, 05:17 AM
Post #4


.
********

Group: WDG Moderators
Posts: 7,946
Joined: 10-August 06
Member No.: 7



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...
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
REJKID
post Oct 7 2018, 07:01 PM
Post #5





Group: Members
Posts: 3
Joined: 26-September 18
Member No.: 26,718



Yep. I need pre-filtering done before the user selects anything. Thanks for the suggestion anyway.
Kind Regards,
Janusz
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 19th November 2018 - 03:02 AM