![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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 ? |
#3
| |||
| |||
|
|
(varying from just type to selecting while directories |
#4
| |||
| |||
|
|
how can I limit the file type to be only jpg and gif extension, when the browse window open ? |
#5
| |||
| |||
|
|
On 21 fév, 12:21, "magix" <ma... (AT) asia (DOT) com> 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 ^^^^ |
|
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/...ml#adef-accept So: input type="file" accept="image/jpg, image/gif" Not tested. |
#6
| ||||
| ||||
|
|
input type="file" accept="image/jpg, image/gif" Not tested. This seems to rely on MIME types (amongst other things), |
|
so in principle could I send a file abc which is encoded as a gif or jpeg and have it accepted? |
|
If the string above worked and no others, what of image/jpeg or image/jpe - are these also encoded by the same codex? |
|
To the strict letter of the OP, perhaps all you need to do is check the last three letters of the filename, but that may run into issues with things like def.gif which is actually an executable..? |
![]() |
| Thread Tools | |
| Display Modes | |
| |