Results 1 to 8 of 8

Thread: How can I get the informations of the selection of a filefield ?

  1. #1
    Sencha User
    Join Date
    Jul 2012
    Location
    France
    Posts
    159
    Answers
    2
    Vote Rating
    3
      0  

    Default How can I get the informations of the selection of a filefield ?

    Hi,
    I have a filefield with a multiple selection, but I can't find informations like how many files have been selected, the MIME type, the size, etc...

    Here is the code :

    PHP Code:
    {
                
    xtype'filefield',
                
    itemId'browseButton',
                
    buttonOnlytrue
            

    PHP Code:
    uploadWin.down('#browseButton').fileInputEl.dom.setAttribute('multiple''1'); 

  2. #2
    Sencha User
    Join Date
    Jul 2012
    Location
    France
    Posts
    159
    Answers
    2
    Vote Rating
    3
      0  

    Default

    The problem persist, I can't get any information of the selection. Not even the name or the number of selected files.

  3. #3
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,409
    Answers
    716
    Vote Rating
    504
      0  

    Default

    The filefield does not return anything when using getValues(), so you could using something like:

    Code:
    form.getForm().getFields().items[0].value // assuming 1st item is filefield
    So to check form (getFields()), just cycle fields, or you can use ComponentQuery() to only check filefield

    Scott.

  4. #4
    Sencha User
    Join Date
    Jul 2012
    Location
    France
    Posts
    159
    Answers
    2
    Vote Rating
    3
      0  

    Default

    With that line, I only get the name of the file, but I'd like to upload this files and I don't think it's possible with only that.

  5. #5
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,232
    Answers
    755
    Vote Rating
    1012
      1  

    Default

    The short answer is you can't, at least not in a cross browser way. Newer browsers support the Files API: http://www.html5rocks.com/en/tutorials/file/dndfiles/
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  6. #6
    Sencha User
    Join Date
    Jul 2012
    Location
    France
    Posts
    159
    Answers
    2
    Vote Rating
    3
      0  

    Default

    Thanks that link seems very interresting !

    But I'd like again a thing: Can I upload with this informations?consoleUpload.jpg
    I've succeed on getting that informations and before going further, I'd like to know if this informations are sufficient.

  7. #7
    Sencha User
    Join Date
    Jul 2012
    Location
    France
    Posts
    159
    Answers
    2
    Vote Rating
    3
      0  

    Default

    I have an upload method in C# side that work. Is it possible with the informations I showed in the last post to fill a filefield? And how to do that?
    Because in the C# side I make a Request of a filefield and then all the method work. But if I don't use a filefield to catch the informations in C#, I don't know how I can get an HttpPostedFileBase type, wich is the type I use for my upload.

  8. #8
    Sencha User
    Join Date
    Jul 2012
    Location
    France
    Posts
    159
    Answers
    2
    Vote Rating
    3
      0  

    Default

    Quote Originally Posted by evant View Post
    The short answer is you can't, at least not in a cross browser way. Newer browsers support the Files API: http://www.html5rocks.com/en/tutorials/file/dndfiles/
    Do you know where can I find a browse button that work in all browser? Because this tuto doesn't work for IE.

Posting Permissions

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