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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

file browser- choose specific files 2

Status
Not open for further replies.

kurie

Programmer
Jun 4, 2008
170
ZA
hi all,
doen anyone know how to make a file browser select specific file types, like just txt and csv.
here is my html code:
<tr> <td align="left">Upload File:</td> <td> <input type="file" size="50" disabled = "true" name="file" id="file"> </td> </tr>

thanks
 
Hi

Try [tt]accept[/tt] :
HTML 4.01 said:
accept = content-type-list [CI]
This attribute specifies a comma-separated list of content types that a server processing this form will handle correctly. User agents may use this information to filter out non-conforming files when prompting a user to select files to be sent to the server (cf. the INPUT element when type="file").
Forms | The [tt]INPUT[/tt] element


Feherke.
 
hi, thanks
i have done this accept ="text/txt,text/csv" but its still displaying the all files and the two i have added to the accept.
can i just display these two.(="text/txt,text/csv")
 
Note the wording used:

User agents [!]may[/!] use this information to filter out non-conforming files

This says to me that they have no onus to honour the accept parameter, so perhaps the browser you are using is one that doesn't honour it.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Hi

Bad luck.

( I had no time to research on this before answering. But a web search indicates that [tt]accept[/tt] is still not supported. So you can do nothing. )

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top