Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

open a folder and view contents from a web page

Status
Not open for further replies.

leearach2004

Technical User
Dec 8, 2005
86
GB
I have search for ever on the net but cant seem to fined a solution to how to open a folder from a link on my web site and view the contents and copy to it as if you where using windows explorer. I have tried using javascript but dont quiet understand how to do this one or if it is possible at all. It was sugested that you just use a link as you would for a file but just enter the path of the folder but that doesent work the link just clicks and goes no where.
I have found a javascript that will do this for the current folder in use when clicked but i cant specify what folder to open
Hope somone out there can help hope to here from you all soon id be most greatful.
 
Do you want the folders that are on your web server to be able to be browsed by the users, or do you want folders on the users computer to be opened for them?

If the former, you'd have to use server-side scripting. If the latter, then this would be browser and operating system dependant, so I'd suggest you think about if this functionality is really necessary (why would you expect a web page to ever open folders on a users computer?)

Hope this helps,
Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Hi there thanks for the reply it was the latter neither of thouse, the problem I have is that I need on a certain page of my site for a folder to open like with windows explorer so that user can copy pictures to that folder which is located on a server, wasnt sure if this was possible but id not do you know anyway road it I would be most greatful
thanks for the reply
 
If you want a file upload control, then use this:

Code:
<input type="file">

If not, you'll really have to better explain what it is you want, and possibly show examples of sites you've seen with similar devices, to aid the explanation. Your last post trails off into gibberish.

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
hi dan thanks for the help im sorry i gibbered on a bit not been doing this long just getting my head arround it. Anyway I have worked out how to open a folder browser from a web site using
window.open('Drive Letter',_Blank,attributes); this opens a file browser window whicj is what I wanted thanks for your help was much apprciated
lee
 
Your solution may work on an intranet, but it won't work unless the user is mapped (with the same drive letter) to the server.

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]

What is Javascript? faq216-6094
 
hi there your right but for my puposes it does the job the only problem I have now is i can acess all files and folders on all servers and display them but how do i display a local drive from a computer accessing the intranet as just using c:\ in the windows.open statment shown above dosnt do anything

lee
 
hi there thanks for that dan but like I said im new to this at the moment I have the user entering the path they want to open into a text box. if i enter the path with c:\\ in the text box there are no errors but nothing is displayed am i surposed to enter the extra \ programaticly im not sure hope you can help and thank you very much
lee
 
sorry no bellow is a copy of the code im using it would be great if you could have a look and tell me how i can access a local c drive when the web page is run from a server.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Folder Display</title>
</head>

<SCRIPT LANGUAGE=javascript>
function Login(form) {
var local = form.local.value;
var local1 = form.local1.value;
if (local&&local1) {
window.open(local,'_blank', 'toolbar=no,location=no,status=yes,scrollbars=auto,copyhistory=no,menubar=no,width=389,height=511'+',left=0,top=0,resizable=no');
window.open(local1,'_blank', 'toolbar=no,location=no,status=yes,scrollbars=auto,copyhistory=no,menubar=no,width=392,height=511,left=399,top=0,resizable=no');
}
else {
alert("NO BLANK FIELDS!");
}
}
</SCRIPT>


<body>

<form onsubmit="Login(this);return false"><pre>
<p>Local
<input name="local">
<input type=submit value="Login">
</p>
<p> Local
<input name="local1">
<input type=submit value="Login">
</p>
<p>&nbsp;</p>
</form>

</body>
</html>
hope this helps sorry im no good at explaning these things into words
hope you can help
lee
 
yes it does work when you run it from a local machine but im running the file from a server but want the code to open the c:\ drive on the machine that has the page open it dosent through any errors but dosent display anything either.
lee
 
hi there
i know you cant access a local drive from a computer you are not at but the web page i am running with this code in is located on a server when i load the page through internet explorer from a computer connect to the network it run fine if you enter a folder or drive location on the server but if you enter c:\ it does nothing dosent show anything or diplay any errors this is the problem I have if the html file is stored on the computer it will display the c: drive but running it from the server to another computer it will not access the c: drive.
I am told this can be done just dont know how
hope this helps more
lee
 
leearach2004, how are you planning on flagging and copying files to the server?
Is the folder you are copying TO on your web server or is it a file server on your network?

Just to be clear, you want your web app to pop open a window on the clients PC allowing them to browse to and select files that they then upload to a server folder?

Dan's original suggestion using type="file" will give you a browse button that opens a window allowing the client to browse their local drives and select a file. You would then need some server side code to handle the upload.

Another possibility is using an HTA application to browse the local client's PC and select the files and even do the transfer. Doing it this way though means that the client must specifically have permissions to write to the folder the files will be copied to whereas the previous method only requires the IUSR_machinename account to have permissions.

An HTA application is essentially a web app that runs client side with client-side permissions. It opens in a simplified browser window and can make use of javascript, vbscript and VBA. The file would have to be downloaded and executed which pops up an ActiveX warning client-side.
If the file is stored on the local PC it can be clicked to execute it without warnings since it is originating on the client PC.


Paranoid? ME?? WHO WANTS TO KNOW????
 
hi there thanks for that what i exactly want is when the button is clicked it brings up two windows on on the wright as shown in the above code to allow access to a folder on the flie server and on on the left which will be the c: on the local computer so they can copy images from the c: drive to the folder on the file server without having to know the location of the folder on the server
does this help explaine any better im sorry im just not good at explaining things hope you can help
lee
 
Then you will have to use a file input as I suggested earlier, along with server-side code.

There is NO other way to upload files to a web server otherwise.

If you simply want to open two windows, one local, one to a known path on a locally-available server (known to you, unknown to the user), then simply hard-code the second path instead of asking the user to type in something which you've already said that they do not know.

Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
thats great that latter of your explination is what i want and it works but only if the page is stored on the local computer when i run the page from the server it brings up the server folder but not the local drive folder this is what i can get to work my code only works if the page is stored localy
lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top