locked
FileUpload web control: specify filename pattern RRS feed

  • Question

  • With the FileUpload ASP.NET web control, is it possible to specify a filename or filetype to limit the files displayed in the browse dialog?

    For example "*.xlsx" or "Foo*.docx"

    • Moved by Mike Feng Tuesday, April 30, 2013 3:45 PM
    Monday, April 29, 2013 7:33 PM

Answers

  • No, it's not possible to filter the file extensions in a file browser control at client side in ASP.NET.

    You could hook up a JavaScript that would trigger when the contents of the text box has changed and then validate the extension though.

    • Proposed as answer by Mike Feng Tuesday, April 30, 2013 3:44 PM
    • Marked as answer by Just Karl Wednesday, October 9, 2013 2:36 PM
    Monday, April 29, 2013 8:58 PM
  • Hi Ben,

    And you can also try this issue on asp.net forum: http://forums.asp.net/ 

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Just Karl Wednesday, October 9, 2013 2:36 PM
    Tuesday, April 30, 2013 3:45 PM

All replies

  • No, it's not possible to filter the file extensions in a file browser control at client side in ASP.NET.

    You could hook up a JavaScript that would trigger when the contents of the text box has changed and then validate the extension though.

    • Proposed as answer by Mike Feng Tuesday, April 30, 2013 3:44 PM
    • Marked as answer by Just Karl Wednesday, October 9, 2013 2:36 PM
    Monday, April 29, 2013 8:58 PM
  • Hi Ben,

    And you can also try this issue on asp.net forum: http://forums.asp.net/ 

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Just Karl Wednesday, October 9, 2013 2:36 PM
    Tuesday, April 30, 2013 3:45 PM