Solved

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

Posted on 2003-11-25
6
2,230 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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

821 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