Solved

Browse for File Dialog Box

Posted on 2004-03-26
7
1,194 Views
Last Modified: 2012-06-27
hi,

is there a "Browse for File Dialog Box" similar to "Browse for Folder Dialog
Box" in vbs.

i havent found something in microsofts scripthelp

thanks for help

for more details

http://www.experts-exchange.com/Web/Web_Languages/Q_20926583.html

If I got the right answer then you will get total 600
0
Comment
Question by:hasnut
  • 4
7 Comments
 
LVL 33

Expert Comment

by:sajuks
ID: 10694953
// browse for folder script. browse for file, havent seenn one yet
<!doctype html public "-//w3c//dtd html 3.2//en">

<html>

<head>
<SCRIPT LANGUAGE="JavaScript">
<!--
  function fnGetMyPathJ()
  {            
    var oShell = new ActiveXObject("Shell.Application");
                      
    var oFolder = new Object;                              
    oFolder = oShell.BrowseForFolder(0, "Choose a folder", 0);
                                        
    var oFolderItem = new Object;            
    oFolderItem = oFolder.Items().Item();                                                
   
    document.all.item("myPath").innerText = oFolderItem.Path;
  }    
-->
</SCRIPT>


<SCRIPT LANGUAGE="VBScript">
<!--
  function fnGetMyPathVB()
    dim oShell
    dim oFolder
    dim oFolderItem
            
    set oShell = CreateObject("Shell.Application")            
    set oFolder = oShell.BrowseForFolder(0, "Choose a Folder", 0)                    
    set oFolderItem = oFolder.Items.Item            
            
    document.all.item("myPath").innerText = oFolderItem.Path                                
  end function
-->
</SCRIPT>


</head>

<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
<INPUT type="button" value="VB" id=button2 name=button2 onClick=fnGetMyPathVB()>
<INPUT type="button" value="JSC" id=button2 name=button2 onClick=fnGetMyPathJ()>

<INPUT type="text" name = "myPath">

</body>

</html>
0
 
LVL 33

Expert Comment

by:sajuks
ID: 10694975
Most Activex security settings dont allow this to run
0
 
LVL 33

Expert Comment

by:sajuks
ID: 10694988

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<script language="JavaScript">
/* File browser (c) 2000 Michel pLungjan */
function goFish(theForm) {
if ( navigator.appName == 'Netscape' && theForm.url.value.indexOf("://",0) == -1 )
  window.open('file://' + theForm.theFile.value, '_self');
else
  window.open(theForm.theFile.value, '_self');
}
</script>
<form NAME="myForm" onSubmit="goFish(this); return false">
<input TYPE="file" NAME="theFile" VALUE size="40">
<input TYPE="submit" VALUE="Go"
</form>



</HTML>
0
 
LVL 1

Author Comment

by:hasnut
ID: 10695012
Hi sajuks,
your first examle only select folder not file,  I need first example that can do both,

You can also give me example dom level that only IE6(not sure) can do.

If you see my other link that I mentioned you will get that same example with folder.


any Ideas?
0
 
LVL 33

Accepted Solution

by:
sajuks earned 500 total points
ID: 10701245
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
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 dynamically set the form action using jQuery.

789 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