.accept = "image/*"

  • Thread starter Thread starter Martin
  • Start date Start date
M

Martin

Dear Group

file1.accept = "image/*"
Why isn't this working? Still get a choice of 'All Files' and 'HTML'.
What do I need to accept .jpg and .gif only?

Tried file1.accept = "image/*" in Page_Load() and Initialize() with no luck.
File Field is running at server.

Thanks for your time & efforts!

Martin
 
What is your file1 control type? Is it an INPUT of type="file" or something
else?

In your click event (submit) check for the ContentType of your uploaded file
(image in your case)
If txtFileUpload.PostedFile.ContentType ="image/jpg, image/gif" Then
'--// Do something Response.Write("Only GIF or JPEG")
End If

Only accept this:
txtFileUpload.ACCEPT="image/jpg, image/gif"

You can also write your own .HTC (HTML script) to add a keyword such as
"Accept" for your upload textbox so that you could do the following:

<input id="txtFileUpload" type="file" size="17" name="txtFileUpload"
runat="server" width="370px" ACCEPT="image/jpg,image/gif">

Hope this helped,

Yama
 
Back
Top