views:

636

answers:

6

Is it possible for a webpage to popup a open folder dialog, ask the user to select a folder, then show the contents of that folder in a list(or something) in the webpage. It won't write to the files, only read them. The webpage is hosted remotely.

Jonathan

A: 

Edited :- Have a look at this. May be a workaround.

ydobonmai
A: 

It'll make you (or your usesr) jump through a thousand hoops, but the ActiveX File System Object can possibly be used to do what you want...

http://msdn.microsoft.com/en-us/library/bkx696eh%28VS.85%29.aspx

edit -- added "possibly"

davidsleeps
+5  A: 

In a word... No.

Requiring an ActiveX plug-in for your application is an invitation to utter failure. Unless you are writing a very target-specific app for an intranet where you control the client configuration, this is just a horrible idea.

There are strict limitations on what a web-based application can do, and this is one of them. What are you trying to accomplish? Perhaps there's a way to do it with a standard file upload dialog? Or WebDAV?

Bryan
amen brother! :)
rtpHarry
+1 - You can't break out of the sandbox!
Sohnee
+1  A: 

I wrote this small piece of code that shows a list of files given a folder name. It is written using VBScript so will work only on IE and FireFox(and maybe only on windows). But it is worth a look

<HTML>
<HEAD>
<SCRIPT LANGUAGE='VBSCRIPT'>
Sub showfiles()
On Error Resume Next
Dim fso, folder, files, sFolder, path

Set fso = CreateObject("Scripting.FileSystemObject")
sFolder = Document.getElementById("fdr").value
Set folder = fso.GetFolder(sFolder)
Set files = folder.Files

For each folderIdx In files
mydiv.innerhtml=mydiv.innerhtml & "<BR/> " & folderIdx.Name
Next
end sub
</SCRIPT>
</HEAD>
<BODY>
<INPUT id="fdr" TYPE="TEXT" VALUE="C:\" />
<INPUT TYPE="BUTTON" ONCLICK="showfiles()" value="show files" />
<DIV id="mydiv"></DIV>
</BODY>
</HTML>
VikrantY
As far as I know this would only work if the user double clicked on the .html file which was saved on their local computer.
rtpHarry
A: 
Carlos Nunez
A: 

You can use a Signed Java Applet, it is a fairly common solution. It works across browsers and platforms. All the user would have to do accept your certificate once and have the java runtime installed.

Alternatively you can write a browser plugin.

MosheI