Solved

filtering only .xls files for <input type="file"...>

Posted on 2003-11-25
6
2,263 Views
Last Modified: 2012-05-04
Hi, when using the <input type="file"...> tag in html, is it possible to use html or javascript to filter out all files except .xls files?

if so, how is this done?

thanks!
0
Comment
Question by:pdanese
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 31

Expert Comment

by:seanpowell
ID: 9819663
You can use the accept attribute directly within the element. If you have multiple file types that you want to allow, separate them with a comma.

<input type="file" accept="application/xls" />
0
 

Author Comment

by:pdanese
ID: 9820059
doesn't seem to work for me (no filtering).  i'm using ie6.0...i input the following, specifically:

 <input type="file" accept="application/xls" name="file1" />


thanks for any other hints.
0
 
LVL 31

Expert Comment

by:seanpowell
ID: 9820170
Hmmm - must be something with the naming conevntion:

<input type="file" accept="application/x-msexcel" name="file1" />
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Expert Comment

by:Timbo87
ID: 9821060
You can't filter the actual popup window. The accept attribute is only for the upload script to determine whether to accept or reject the file.
0
 
LVL 31

Accepted Solution

by:
seanpowell earned 50 total points
ID: 9821332
Are you trying to filter which files get viewed, or which get uploaded? I thought it was the second you were after. Obviously there's no way to limit the file listing itself...
0
 

Author Comment

by:pdanese
ID: 9821475
yes, i was looking to filter files that get viewed.

thanks for the input, tho.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Triple line in an alert message 4 36
disable open new tab with right mouse click in <a> tag 3 41
Loading Self-Hosted Fonts 12 43
Save data in two Database, Asp 2 68
When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question