File Upload Control

  • Thread starter Thread starter Jon Natwick
  • Start date Start date
J

Jon Natwick

I would like to limit the file types that users can upload.

<input id="tbFileUpload" type="file" runat="server">

This setting looks like it should it work, but it's not working for me.

tbFileUpload.Accept = "gif,bmp";

Any suggestions?
 
while the w3c has defined this attribute, neither IE or firefox support it.

-- brce (sqlwork.com)


| I would like to limit the file types that users can upload.
|
| <input id="tbFileUpload" type="file" runat="server">
|
| This setting looks like it should it work, but it's not working for me.
|
| tbFileUpload.Accept = "gif,bmp";
|
| Any suggestions?
|
|
 
The Accept property of an HtmlInputFile object is a comma-delimited list of
MIME types. "gif" and "bmp" are not MIME types; they are file extensions.
Here's what you need to put:

tbFileUpload.Accept = "image/gif,image/bmp";

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
bruce barker said:
while the w3c has defined this attribute, neither IE or firefox support
it.

-- brce (sqlwork.com)


| I would like to limit the file types that users can upload.
|
| <input id="tbFileUpload" type="file" runat="server">
|
| This setting looks like it should it work, but it's not working for me.
|
| tbFileUpload.Accept = "gif,bmp";
|
| Any suggestions?
|
|
 
Honestly, Jon, I don't know. I've never used it. I always use JavaScript
validation, and check the "value" property of the File Upload before sending
it.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
Back
Top