Web Layout
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsWeb DesignWeb Layout

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old September 3rd, 2004, 03:08 PM
LASteve LASteve is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 2 LASteve User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Browse Button in HTML For Directory Selection Alone…Not File Selection

Topic: Browse Button in HTML For Directory Selection Alone…Not File Selection

I have an issue regarding wanting to put a Browse button on an html page that will allow a user to select a directory path....not a file.....on their local machine.

That selected directory path then would get populated into a text input field submission on a web form. The scenario involves asking a person during a web based registration process where the user would like files downloaded locally to their machine. FYI the site is being built in ASP.NET. You want them to be able to hit a browse button, maneuver through a directory path on their local machine, select an end directory, and then have that directory path alone (meaning not being required to include a file name from within the directory) be populated into the input field for submission to the user's profile store.

Does anyone have any samples of HTML code that shows how this is accomplished?

Any good web site examples that can demonstrate this as well?


Thanks in advance.

Very much appreciated.

Steve

Reply With Quote
  #2  
Old September 23rd, 2004, 08:33 AM
frankcow's Avatar
frankcow frankcow is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: http://www.justin-cook.com
Posts: 133 frankcow User rank is Private First Class (20 - 50 Reputation Level)frankcow User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 h 34 m 16 sec
Reputation Power: 5
just check the filed value with JavaScript, and make sure the last character is a "\"

Reply With Quote
  #3  
Old September 23rd, 2004, 09:32 AM
selwonk's Avatar
selwonk selwonk is offline
Contributing User
ASP Free Frequenter (2500 - 2999 posts)
 
Join Date: Jun 2004
Posts: 2,943 selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 6 Days 10 h 7 m 31 sec
Reputation Power: 62
You will never receive a directory name back from the type="file" input button, but you could extract the directory from the filename:
Code:
<html>
<head>
<title>Return file directory</title>
<script language="JavaScript">
 function GetDirectory() {
  strFile = document.MyForm.MyFile.value;
  intPos = strFile.lastIndexOf("\\");
  strDirectory = strFile.substring(0, intPos);
  alert(strFile + '\n\n' + strDirectory);
  return false;
 }
</script>
</head>
<body>
<form name="MyForm">
<input type="file" name="MyFile">
<input type="button" value="Get directory" onClick="GetDirectory();">
</form>
</body>
</html>
__________________
selwonk

If I've posted some code above, you might think it looks a bit simplistic. It might be. I'd rather people tried the next step themselves rather than getting a full solution on a plate. That way they learn more!

Reply With Quote
  #4  
Old June 22nd, 2005, 10:19 PM
vince144 vince144 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 1 vince144 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 56 sec
Reputation Power: 0
is there no other way to do this?

any help appreciated.

Reply With Quote
Reply

Viewing: ASP Free ForumsWeb DesignWeb Layout > Browse Button in HTML For Directory Selection Alone…Not File Selection


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT