?
Solved

Selecting a folder from browser?

Posted on 2003-03-31
8
Medium Priority
?
125 Views
Last Modified: 2011-09-20
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
Comment
Question by:ServerOverflow
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
8 Comments
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 8242214
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
 
LVL 2

Expert Comment

by:memerot
ID: 8255500
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
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 8255957
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
Technology Partners: 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!

 

Author Comment

by:ServerOverflow
ID: 8256479
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
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 8257091
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
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 200 total points
ID: 8257185
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
 

Author Comment

by:ServerOverflow
ID: 8257915
I guess that will have to do, thanks Cd
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 8261609
Glad we could help. Thanks for the A. :^)

Cd&
0

Featured Post

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Matthew
I am a very big proponent of technology compliance standards and strive to meet such criteria in all of my work. That includes my site, which is 100% XHTML 1.0 compliant as determined by the World Wide Web Consortium. https://www.matthewstevenkel…
Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question