Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jul 2009
    Thanked 0 Times in 0 Posts

    need help regarding getting directory path not file.

    hi all,

    i have this web application in which the user has to browse and select a folder but not file. i used <input type="file"> , which helps in retrieving only files.

    any help regarding this is greatly appreciated.


  • #2
    Regular Coder
    Join Date
    Mar 2008
    Thanked 30 Times in 30 Posts
    If you still have this problem, maybe you could be more specific with the code that's causing the problem.

  • #3
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    London, England
    Thanked 2,573 Times in 2,551 Posts
    JavaScript itself has no file or directory I/O capabilities. If you're talking about an intranet (not the Internet) and you're talking about IE-only, then JavaScript has the ability to raise an ActiveX control to perform file and directory I/O. Otherwise It is not possible to select a folder as opposed to a file in that folder in any browser. This is probably a security issue.

    "It is not as cold as it was yesterday, but that's probably because it's a bit warmer." - Sports commentator
    Last edited by Philip M; 07-17-2009 at 09:01 AM.

  • #4
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Thanked 603 Times in 583 Posts
    the dialog box trigged by file upload inputs is native to the OS.
    Windows provides several flavors of dialog boxes though its common dialog library; save as, file open, folder open, muiltiple file open, etc...

    the one that IE used was of the "select a single file to open" flavor.
    that makes sense given the task of an <input type="file">.

    all subsequent browsers, even the ones that provide their own internal file browse dialogs, duplicate the original functionality afaik.

    firefox, beginning in version 3.0 removes the file path from a <input type="file">'s value property.

    others might still leave the path, and for those browsers, a user could select any file in the folder and you could figure out which folder it was in.

    but in no browser can you select an empty folder, or anything other than a file.
    Last edited by rnd me; 07-17-2009 at 10:41 AM.
    my site (updated 2014/10/20)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.3, IE11:9.2, IE9:2.7, IE10:2.6, FF:16.8, CH:47.5, SF:7.8, NON-MOUSE:37%


    Posting Permissions

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