Solved

Browse for File Dialog Box

Posted on 2004-03-26
7
1,190 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
Comment Utility
// 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
Comment Utility
Most Activex security settings dont allow this to run
0
 
LVL 33

Expert Comment

by:sajuks
Comment Utility

<!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
Comment Utility
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
Comment Utility
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

There are two main kinds of selectors in CSS: One is base selector like h1, h2, body, table or any existing HTML tags.  For instance, the following rule sets all paragraphs (<p> elements) to red: (CODE) CSS also allows us to define our own custom …
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…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

763 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now