29

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'?

2
  • which one is your code 1st one or second one/..? and i think you need to change your accept attribute's criteria it's working as you wrote code in html so what you need .?? or what is the problem.? Commented Sep 4, 2015 at 7:03
  • oky got the point you want to make all as upload as one but want to make choosy in file format Commented Sep 4, 2015 at 7:06

2 Answers 2

50

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

Sign up to request clarification or add additional context in comments.

3 Comments

@hahahaha check out the answer
It works on Firefox, but not on Chrome... Chrome still shows "Custom Files".
@feature_engineer I opened a bug in Chromium regarding this matter issues.chromium.org/342067849
1

For PDFs in 2023 via chrome

image/*, application/pdf

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.