Click here to get back home

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
magix 02-21-2008
---> Re: Rik Wasmus02-21-2008
| `--> Re: Rik Wasmus02-21-2008
---> Re: GTalbot02-21-2008
  |--> Re: Jonathan N. Lit...02-21-2008
  |--> Re: Stephan Bird02-22-2008
  `--> Re: Jukka K. Korpel...02-22-2008
Posted by magix on February 21, 2008, 12:21 pm
Please log in for more thread options
Hi,

with:
<Input type="file"...>

it will let the user to click to "browse" button to browse for files,
question is how can I limit the file type to be only jpg and gif extension,
when the browse window open ?

thank you.

Regards,
Magix



Posted by Rik Wasmus on February 21, 2008, 1:56 pm
Please log in for more thread options
> with:
> <Input type=3D"file"...>
>
> it will let the user to click to "browse" button to browse for files,
> question is how can I limit the file type to be only jpg and gif =

> extension,
> when the browse window open ?

Nope, not a widely supported anyway, I seem to remember some browser =

specific options, but they don't play nice together. If this is a must, =
=

look into a flash (or possibly java) uploader, which can be more =

controlled (varying from just type to selecting while directories/mulitp=
le =

files at once). Be sure to provide a clean HTML fallback.
-- =

Rik Wasmus

Posted by Rik Wasmus on February 21, 2008, 1:58 pm
Please log in for more thread options
On Thu, 21 Feb 2008 19:56:26 +0100, Rik Wasmus
> (varying from just type to selecting while directories

...varying from just extensions, to selecting whole directorie.
--
Rik Wasmus

Posted by GTalbot on February 21, 2008, 6:19 pm
Please log in for more thread options

> how can I limit the file type to be only jpg and gif extension,
> when the browse window open ?

accept =3D 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=3D"file").
http://www.w3.org/TR/html4/interact/forms.html#adef-accept

So:

<input type=3D"file" accept=3D"image/jpg, image/gif">

Not tested.

G=E9rard

Posted by Jonathan N. Little on February 21, 2008, 7:36 pm
Please log in for more thread options
GTalbot wrote:
>
>> how can I limit the file type to be only jpg and gif extension,
>> when the browse window open ?
>
> 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
^^^^
The operative word is "may" and *none* of the browsers I have FF,
SeaMonkey, Opera, IE and old Netscape do.

> prompting a user to select files to be sent to the server (cf. the
> INPUT element when type="file").
> http://www.w3.org/TR/html4/interact/forms.html#adef-accept
>
> So:
>
> <input type="file" accept="image/jpg, image/gif">
>
> Not tested.

The only way check at the receiving server side script. You can use the
option of additionally prescreening the selection with JavaScript.

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com


Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap