Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 126
  • Last Modified:

Selecting a folder from browser?

I was woundering if there was a way to select a folder in the same way the file upload box works.
That is I would like the user to be able to search their drive for a folder and select that. (getting the folder or something in it is unimportant, all I need is the path)



Thanks
0
ServerOverflow
Asked:
ServerOverflow
  • 5
  • 2
1 Solution
 
COBOLdinosaurCommented:
Nope.  Can't be done.  The input file tag can only be used to browse for files.  The security on that control is critical to maintaining privacy, and prventing theft of data.

Cd&
0
 
memerotCommented:
There IS a way to do it, but it's not as simple as <input type="file">.

You'd have to use ActiveX objects and use the FileSystemObject to get a list of drives and subfolders.  It would only run in IE/Windows machines, and would bump into a lot of security problems depending on machine set up.
0
 
COBOLdinosaurCommented:
Even with activeX you still run into security issues, and the user has to specifically allow the activeX component.  That might be appropriate on an intranet, wehere everything is behind he firewall, but then you don't need a web page anyway, you just share the folders and/or drives.  On the Internet forget it a sysadmin would hvae to be nuts to let an activeX component like that past firewall

Cd&
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
ServerOverflowAuthor Commented:
Hmmmm would it be possible to use a input file, but then parse the path (with js or something) to grab the path, and then ignore whatever the actual file selected was?
0
 
COBOLdinosaurCommented:
Yes, you can put the value of the input file into a string and parse it, but you cannot change the value of the input file.

Cd&
0
 
COBOLdinosaurCommented:
You will need to do somthing like this:
         str=new String(document.theform.thefile.value);
         pntr=str.lastIndexOf("\\");
         path=str.substring(0,pntr);

Cd&
0
 
ServerOverflowAuthor Commented:
I guess that will have to do, thanks Cd
0
 
COBOLdinosaurCommented:
Glad we could help. Thanks for the A. :^)

Cd&
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now