Solved

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

Posted on 2003-11-25
6
2,186 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
  • 3
  • 2
6 Comments
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
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
Comment Utility
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
Comment Utility
Hmmm - must be something with the naming conevntion:

<input type="file" accept="application/x-msexcel" name="file1" />
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 15

Expert Comment

by:Timbo87
Comment Utility
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
Comment Utility
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
Comment Utility
yes, i was looking to filter files that get viewed.

thanks for the input, tho.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

This article discusses how to create an extensible mechanism for linked drop downs.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now