Solved

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

Posted on 2003-11-25
6
2,310 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
Are You Using the Best Web Development Editor?

The worlds of web hosting and web development are constantly evolving. Every year we see design trends change, coding standards adapt and new frameworks/CMS created. With such a quick pace of change it’s easy to get lost trying to keep up.

See if your editor made the list.

 
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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

630 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