Results 1 to 2 of 2

Thread: how to fire event after a file is selected with browse button

  1. #1
    Join Date
    Apr 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default how to fire event after a file is selected with browse button

    I would like to validate the file type after a file is selected using browse button, is it possible?

    I know this can be done using validation of the entire form with submit button however, is there a way to fire an event after a file is selected using browse button??

    Thanks

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Although, due to security restrictions, the file input is the most restricted of all HTML form elements, in limited testing it appears to still fire the onchange event:

    Code:
    <input type="file" onchange="alert(this.value)">
    Unless you also need help with your validation routine, this should give you all you need to activate your code which determines the file type.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •