Web Design Web Design Forum
Registration is free! Here you can view your subscribed threads, work with private messages and edit your profile and preferences Calendar Find other members Frequently Asked Questions Search
Home Web Design

Convenient web based access to our favorite web design Usenet groups

web design reviews

This is Interesting: Free Magazines for Graphics designers and webmasters  





Pages (2): [1] 2 »   Last Thread  Next Thread
Author
Thread Post New Thread   

Filtering valid file types
 

Dylan Parry




quote this post edit post

IP Loged report this post

Old Post  06-09-06 - 12:27 AM  
Hi folks,

If I have an <input type="file" /> element, is there any way of
filtering the file types shown when the user clicks on the browse
button? Currently I check the file extension using client-side
scripting, then on a successful upload I check it properly on the
server-side, rejecting at any step invalid files.

This is okay in some respects, but it would be much handier if the user
only saw (for example) *.jpg files as an option in the browse dialog in
the first place.

Can this be achieved, either through scripting or otherwise?

Cheers,

--
Dylan Parry
http://electricfreedom.org -- Where the Music Progressively Rocks!


Post Follow-Up to this message ]
Re: Filtering valid file types
 

trevor




quote this post edit post

IP Loged report this post

Old Post  06-09-06 - 12:27 AM  
Dylan Parry wrote:

> Hi folks,
>
> If I have an <input type="file" /> element, is there any way of
> filtering the file types shown when the user clicks on the browse
> button? Currently I check the file extension using client-side
> scripting, then on a successful upload I check it properly on the
> server-side, rejecting at any step invalid files.
>
> This is okay in some respects, but it would be much handier if the user
> only saw (for example) *.jpg files as an option in the browse dialog in
> the first place.
>
> Can this be achieved, either through scripting or otherwise?
>
> Cheers,
>

HTML had an "accept" attribute for <input>....

*runs away*
*runs back*

i just checked and it's still there in XHTML. wonder what cross
platform/browser support will be.


Post Follow-Up to this message ]
Re: Filtering valid file types
 

Steve Pugh




quote this post edit post

IP Loged report this post

Old Post  06-09-06 - 12:27 AM  
trevor <not@home.now> wrote:

>HTML had an "accept" attribute for <input>....
>
>*runs away*
>*runs back*
>
>i just checked and it's still there in XHTML. wonder what cross
>platform/browser support will be.

Close to zero support. Very, very close to zero support.

Steve
--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie."  - The Doctor

Steve Pugh        <steve@pugh.net>        <http://steve.pugh.net/>


Post Follow-Up to this message ]
Re: Filtering valid file types
 

trevor




quote this post edit post

IP Loged report this post

Old Post  06-09-06 - 12:27 AM  
Steve Pugh wrote:

> trevor <not@home.now> wrote:
> 
>
> Close to zero support. Very, very close to zero support.
>
> Steve

so it would be a job for the Java people (or something even more hideous).
more hassle than i'd think it's worth. fun question though. i wonder why i
haven't heard it yet.


Post Follow-Up to this message ]
Re: Filtering valid file types
 

Dylan Parry




quote this post edit post

IP Loged report this post

Old Post  06-09-06 - 12:27 AM  
trevor wrote:

["accept" attribute for <input>]
> i just checked and it's still there in XHTML. wonder what cross
> platform/browser support will be.

As Steve says, it's almost zilch, which is why it isn't something I can
use. I should have mentioned that I had seen that "solution" already,
but figured that others would know (like myself) that the support just
isn't there... never make assumption! :)

--
Dylan Parry
http://webpageworkshop.co.uk -- FREE Web tutorials and references


Post Follow-Up to this message ]
Re: Filtering valid file types
 

Toby Inkster




quote this post edit post

IP Loged report this post

Old Post  06-09-06 - 12:28 AM  
Dylan Parry wrote:

> This is okay in some respects, but it would be much handier if the user
> only saw (for example) *.jpg files as an option in the browse dialog in
> the first place.

What about these files:

picture_which_i_want_to_upload_to_dylan.jpeg
picture_which_i_want_to_upload_to_dylan.my_jpeg_image
picture_which_i_want_to_upload_to_dylan

??

--
Toby A Inkster BSc (Hons) ARCS
Contact Me  ~ http://tobyinkster.co.uk/contact



Post Follow-Up to this message ]
Re: Filtering valid file types
 

William Tasso




quote this post edit post

IP Loged report this post

Old Post  06-09-06 - 12:28 AM  
Fleeing from the madness of the  jungle
Dylan Parry <usenet@dylanparry.com> stumbled into news:alt.www.webmaster
and said:

> Hi folks,
>
> If I have an <input type="file" /> element, is there any way of
> filtering the file types shown when the user clicks on the browse
> button? Currently I check the file extension using client-side
> scripting, then on a successful upload I check it properly on the
> server-side, rejecting at any step invalid files.
>
> This is okay in some respects, but it would be much handier if the user
> only saw (for example) *.jpg files as an option in the browse dialog in
> the first place.
>
> Can this be achieved, either through scripting or otherwise?

AIUI you have no control over the 'browse' functionality - tis a security
feature.

--
William Tasso

http://williamtasso.com/words/what-is-usenet.asp


Post Follow-Up to this message ]
Re: Filtering valid file types
 

Dylan Parry




quote this post edit post

IP Loged report this post

Old Post  06-09-06 - 12:28 AM  
Toby Inkster wrote:

> What about these files:
>
>  picture_which_i_want_to_upload_to_dylan.jpeg
>  picture_which_i_want_to_upload_to_dylan.my_jpeg_image
>  picture_which_i_want_to_upload_to_dylan

Not remotely interested in allowing people to upload such files. The
file types I will allow people to upload are a proprietary type called
*.shp, which are a type of file that contain mapping data. They only
ever come as *.shp and are completely invalid in any other extension.

This is for a completely closed system, so Joe Public isn't going to be
using it. The idea behind using a filter is so that I personally don't
have to trawl through a directory of files that aren't *.shp files.

--
Dylan Parry
http://webpageworkshop.co.uk -- FREE Web tutorials and references


Post Follow-Up to this message ]
Re: Filtering valid file types
 

Dylan Parry




quote this post edit post

IP Loged report this post

Old Post  06-09-06 - 12:28 AM  
William Tasso wrote:

> AIUI you have no control over the 'browse' functionality - tis a security
> feature.

Oh well. I personally can't see how the ability to filter out file types
can be a security feature when done by the browse dialog in a web
browser as opposed to the same dialog in Office, Photoshop or any other
program that does this.

--
Dylan Parry
http://electricfreedom.org -- Where the Music Progressively Rocks!


Post Follow-Up to this message ]
Re: Filtering valid file types
 

Charles Sweeney




quote this post edit post

IP Loged report this post

Old Post  06-09-06 - 12:28 AM  
Dylan Parry wrote

> Toby Inkster wrote:
> 
>
> Not remotely interested in allowing people to upload such files. The
> file types I will allow people to upload are a proprietary type called
> *.shp, which are a type of file that contain mapping data. They only
> ever come as *.shp and are completely invalid in any other extension.
>
> This is for a completely closed system, so Joe Public isn't going to
be
> using it. The idea behind using a filter is so that I personally don't
> have to trawl through a directory of files that aren't *.shp files.

If you have control of the machines doing the uploading, can't you make
the "Browse" facility on the machine default to a particular
directory/file type?

--
Charles Sweeney
http://CharlesSweeney.com


Post Follow-Up to this message ]
Sponsored Links
 





All times are GMT. The time now is 08:10 AM. Post New Thread   
Pages (2): [1] 2 »   Previous Last Thread   Next Thread next
Webmaster forum archive | Show Printable Version | Email this Page | Subscribe to this Thread

Popular forums

Adobe Photoshop forum Macromedia Flash Web Site Design
Dreamweaver FrontPage forum
JavaScript Forum XML forum
Style Sheets VRML
Forum Jump:
Rate This Thread:

 

XML RSS Feed web design latest articles Syndicate our forum via XML or simple JavaScript

Web Design archive  Database administration help  


Top Home  -  Register  -  Control Panel   -  Memberlist  -  Calendar  -  Faq  -  Search Top