Hello and welcome to our community! Is this your first visit?
Register
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
    Posts
    1
    Thanks
    0
    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.

    Thanks,
    terry

  • #2
    Regular Coder
    Join Date
    Mar 2008
    Posts
    301
    Thanks
    2
    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
    Location
    London, England
    Posts
    17,729
    Thanks
    202
    Thanked 2,507 Times in 2,485 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 08:01 AM.

  • #4
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,184
    Thanks
    10
    Thanked 569 Times in 550 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 09:41 AM.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/1/19) IE7:0.2, IE8:6.7, IE11:7.4, IE9:3.8, IE10:4.4, FF:18.3, CH:43.6, SF:7.8, MOBILE:27.5


  •  

    Posting Permissions

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