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: 7
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 Loyal (3000 - 3499 posts)
 
Join Date: Jun 2004
Posts: 3,067 selwonk User rank is First Lieutenant (10000 - 20000 Reputation Level)selwonk User rank is First Lieutenant (10000 - 20000 Reputation Level)selwonk User rank is First Lieutenant (10000 - 20000 Reputation Level)selwonk User rank is First Lieutenant (10000 - 20000 Reputation Level)selwonk User rank is First Lieutenant (10000 - 20000 Reputation Level)selwonk User rank is First Lieutenant (10000 - 20000 Reputation Level)selwonk User rank is First Lieutenant (10000 - 20000 Reputation Level)selwonk User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 8 h 28 m 37 sec
Reputation Power: 185
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





 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

 

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





© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek