Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I filter filetypes in the browse function? 1

Status
Not open for further replies.

Craigath

Programmer
Feb 19, 2003
3
NL
I'm creating an open function for a program, that only has to and can open one type of file: xml.

With the following code you get a textfield and a browse button:

input type="file" name="open_dia" style="display:none"

but in this state the browse function shows all of the filetypes, jpgs or html files (those three options are available in the dropdownlist 'files of type'). But my question is, is there some way to let him show only xml files?

Thanks in advance
Craigath
 
In theory, you can define the type of file you want like this:

Code:
input type="file" accept="text/xml" name="open_dia" style="display:none">

However, I don't think any current browsers take much notice of the
Code:
accept
attribute :-( . -- Chris Hunt
Extra Connections Ltd
 
You might have to use PHP or something instead.

forum434 frozenpeas
 
hmmm... you're right chris, it does not work :s
I'll go and search for a solution in PHP.

Thanks for trying and the tip though!

Jos
 
Thx Frozenpeas

that is a very helpful link, cause i also needed that information (uploading). So the link is double helpful for me.

Greetz Jos
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top