Results 1 to 5 of 5

Thread: Displaying only specific types of files in the filefield control

  1. #1
    Sencha User
    Join Date
    Nov 2012
    Posts
    21
    Vote Rating
    1
      0  

    Default Displaying only specific types of files in the filefield control

    Hi,

    I want to show only CSV files using filefield the dialog are only CSV files. Is there some property in 'filefield ' needs to be set/overriden?

    Thanks in advance.

  2. #2
    Sencha User
    Join Date
    Dec 2009
    Location
    Enschede, The Netherlands
    Posts
    327
    Answers
    16
    Vote Rating
    14
      0  

    Default

    There is no option to do this on form.field.File as far as I know.

    One direction for a solution might be: http://stackoverflow.com/questions/8...ific-file-type, however this doesn't work in every browser. Which might be the reason ExtJS doesn't support it - nor will.

    I fear this is going to be a tricky one since most browsers are focusing on the webpage not being able to interfere with the local computer.

  3. #3
    Sencha User Arg0n's Avatar
    Join Date
    Apr 2012
    Location
    Germany
    Posts
    122
    Answers
    12
    Vote Rating
    16
      0  

    Default

    Impossibile ^^

    You can't filter displayed file types. It's restricted by browsers. What you can do is add a validator, which checks the ".csv"

    Only files with .csv:

    Code:
    regex: /^.*\.(csv|CSV)$/,
    regexText: 'Only CSV files allowed'
    Last edited by Arg0n; 29 Nov 2012 at 1:59 AM. Reason: added code example o.O

  4. #4
    Sencha User
    Join Date
    Nov 2012
    Posts
    21
    Vote Rating
    1
      0  

    Default

    Quote Originally Posted by Arg0n View Post
    Impossibile ^^

    You can't filter displayed file types. It's restricted by browsers. What you can do is add a validator, which checks the ".csv"

    Only files with .csv:

    Code:
    regex: /^.*\.(csv|CSV)$/,
    regexText: 'Only CSV files allowed'
    Yes u r ri8, Thanks Arg0n.

  5. #5
    Sencha User Arg0n's Avatar
    Join Date
    Apr 2012
    Location
    Germany
    Posts
    122
    Answers
    12
    Vote Rating
    16
      0  

    Default

    Better way would be to build an own validator for it.

    See: Form Package Guide (2. Custom Validations)

    =)

Tags for this Thread

Posting Permissions

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