HtmlInputFile: Why Accept Property not recognized


Hi,

I wonder why "accept" is not recognized. Any idea how to solve this?
Message displayed in showtooltip : Could not find any attribute 'accept' of element 'input'.

Please see the code below:






Thanks

Comments

  • :
    : Hi,
    :
    : I wonder why "accept" is not recognized. Any idea how to solve this?
    : Message displayed in showtooltip : Could not find any attribute 'accept' of element 'input'.
    :
    : Please see the code below:
    :
    :
    :
    :
    :
    :
    : Thanks
    :
    :

    This is one of those HTML 4.0 features that never got implemented by at least by Internet Explorer that I know of. This stinks because I'm come across the same problem as well. I am not sure if Internet Explorer, particularly, has a scripting behavior that rectifies this.

    Note: If you need to limit the file type that can be uploaded then you need to check the ContentType property. Here is an example:

    [code]

    [/code]

    [code]
    Dim contentType As String = upload.PostedFile.ContentType

    Select Case contentType.ToLower
    Case "image/gif"
    ' Supports GIF Images

    Case "image/jpeg", "image/pjpeg"
    ' Supports JPEG Images

    Case Else
    ' Not Supported

    End Select
    [/code]

    Checking the file extension is not enough because its possible to rename a file and its extension bypassing your file filter. The ContentType property doesn't suffer from this tactic.

  • : :
    : : Hi,
    : :
    : : I wonder why "accept" is not recognized. Any idea how to solve this?
    : : Message displayed in showtooltip : Could not find any attribute 'accept' of element 'input'.
    : :
    : : Please see the code below:
    : :
    : :
    : :
    : :
    : :
    : :
    : : Thanks
    : :
    : :
    :
    : This is one of those HTML 4.0 features that never got implemented by at least by Internet Explorer that I know of. This stinks because I'm come across the same problem as well. I am not sure if Internet Explorer, particularly, has a scripting behavior that rectifies this.
    :
    : Note: If you need to limit the file type that can be uploaded then you need to check the ContentType property. Here is an example:
    :
    : [code]
    :
    : [/code]
    :
    : [code]
    : Dim contentType As String = upload.PostedFile.ContentType
    :
    : Select Case contentType.ToLower
    : Case "image/gif"
    : ' Supports GIF Images
    :
    : Case "image/jpeg", "image/pjpeg"
    : ' Supports JPEG Images
    :
    : Case Else
    : ' Not Supported
    :
    : End Select
    : [/code]
    :
    : Checking the file extension is not enough because its possible to rename a file and its extension bypassing your file filter. The ContentType property doesn't suffer from this tactic.
    :
    :

    Thank you iwilld0it. =)

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories