Solved

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

Posted on 2003-11-25
6
2,200 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
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
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 …

896 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

14 Experts available now in Live!

Get 1:1 Help Now