hahahaha
hahahaha

Reputation: 1031

Multiple File Options When Upload File in Input Accept Attribute

I want to show multiple file type option when upload the files.

I refer to this: http://jsfiddle.net/dirtyd77/LzLcZ/144/ .

It works great when only one type of file is appear on the option.

<p>Only show Excel (.xlsx) files...</p>
<input type="file" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ID="fileSelect" runat="server" />  

but it will show 'Custom Files' when it has multiple options. as shown in image below.

<p>Show .xls, .xlsx, .csv files...</p>
<input type="file" accept=".csv, .pdf" ID="fileSelect" runat="server" />  

enter image description here

Is there any way to show multiple options (1row for PDF, 1row for image, 1row for Excel, etc) in the file type dropdown menu? Instead of showing 'Custom Files'?

Upvotes: 29

Views: 35851

Answers (2)

leiikun
leiikun

Reputation: 263

For PDFs in 2023 via chrome

image/*, application/pdf

Upvotes: 1

Himesh Aadeshara
Himesh Aadeshara

Reputation: 2121

hi i have tried this and worked

the problem was the space you have given between the .csv, .pdf as i thought

<p>MY CUSTOM ONE</p>
<input type="file" accept="image/*,video/*,.pdf,.csv" ID="fileSelect" runat="server" />  

here is your updated fiddle work

DEMO code working

Upvotes: 50

Related Questions