locked
How to select both Folders & Files using the file picker? RRS feed

  • Question

  • Can we select the folder and the files in the flie picker?I find that we could select only one of them now.
    Sunday, November 18, 2012 5:42 AM

All replies

  • Hi,

    You could select more files in the file picker. It is not support to select folders.

    <!DOCTYPE html>
    <html >
    <head>
        <title>Files property test</title> 
        <script type="text/javascript">
            function getFiles() {
                // Get input element
                myFileList = document.getElementById("myfiles");
                // loop through files property, using length to get number of files chosen
                for (var i = 0; i < myFileList.files.length; i++) {
                    // display them in the div
                    document.getElementById("display").innerHTML += "<br/>" + myFileList.files[i].name ;
                }
            }
    </script>
    </head>
    <body>
    <label>Use <strong>shift</strong> or <strong>ctrl</strong> click to pick a few files: 
    <input type="file" multiple id="myfiles" onchange="getFiles();" /></label>
    
    <div id="display"></div>
    </body>
    </html>


    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com
    Microsoft One Code Framework

    Monday, November 19, 2012 6:47 AM
  • Oh,thanks.I know this,maybe it isn't support to select the files and folder at the same time with the file piker. I have another question:can we write the file piker control by ourselves to finish the browser folder and files function? How to do this?
    • Edited by bing_g Monday, November 19, 2012 8:48 AM
    Monday, November 19, 2012 8:48 AM
  • Hi,

    Then try to use FolderPicker.

    #FolderPicker class

    http://msdn.microsoft.com/library/windows/apps/BR207881


    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com
    Microsoft One Code Framework

    Wednesday, November 21, 2012 3:04 AM
  • But the folder piker just can "Represents a UI element that lets the user choose folders."

    Thursday, November 22, 2012 1:05 PM
  • And the folder picker does not allow to select multiple folders on different hierarchies like the FilePicker.
    Thursday, November 22, 2012 2:27 PM