Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   HTML / XHTML / CSS (http://www.programmingforums.org/forum27.html)
-   -   Allow user to select a directory (http://www.programmingforums.org/showthread.php?t=10139)

MegaArcon Jun 2nd, 2006 1:30 PM

Allow user to select a directory
 
Hi all! :D

I've got a web page where I want the user to be able to select a directory so that my script can preform actions on that directory. The problem is that the only form input that I'm aware of that lets a user do something similar to this would be the

:

<input type="file" />

tag. However, this will not allow the user to select a directory...it seems that it HAS to be a file. Is there any other tag or method I can use to let the user of the web page select a directory? (I'm using python as the cgi if that makes any difference to the method.)

Thanks in advance! :D

Agent 47 Jun 2nd, 2006 2:12 PM

Only way I can think of is with a Java Applet.

MegaArcon Jun 2nd, 2006 2:27 PM

Java Applet, eh? So create an applet to prompt the user with a search box and then use that to submit the form?

Tricky...or at least it might be....I've programmed in Java but I've never done so with applets before. Well...at least it's a possible solution. ^_^

I'll look into it more. Thanks Agent 47!

crawforddavid2006 Jun 2nd, 2006 4:21 PM

Why not Java Script?

Agent 47 Jun 3rd, 2006 5:20 AM

Quote:

Originally Posted by crawforddavid2006
Why not Java Script?

You can't interact with the user's file system using JavaScript.

Arevos Jun 3rd, 2006 5:30 AM

Quote:

Originally Posted by MegaArcon
Java Applet, eh? So create an applet to prompt the user with a search box and then use that to submit the form?

The applet would have to be signed by a trusted signature in order to access filesystem information, and even then a box would pop up asking you for confirmation. Trusted signatures that will work on any Java enabled machines aren't cheap, either.

Generally speaking, there isn't an easy way to manipulate a directory from a website. Browsers are designed specifically to stop that sort of potentially malicious tampering. The only way to get around it is to use a third-party plugin, like Java, although most popular plugins have extensive security measures designed to prevent access to the local filesystem.

a thing Jun 3rd, 2006 10:29 AM

You could just have the user type in the directory.

DaWei Jun 3rd, 2006 11:06 AM

Quote:

Originally Posted by the OP said:
so that my script can preform actions on that directory

Just getting a directory name performs no astounding magic. The seeds of fact are in the posts above. One does not dink with the client's machine without the client's permission to accept a piece of software that works outside the usual paradigm.

MegaArcon Jun 4th, 2006 7:55 PM

My bad, I should have been more specific. ;)

It's not the web script that will be preforming the actions on the directory. It will basically be a script that python is going to call that will do a change uid to that user and then do things with the directory. (More actually, zip certain files and send a copy of that zip file to the server). I know my audiece and they are (or at least will be) aware that the web page is going to zip up some files from their directory.

As for having the user type in the directory....that goes back to knowing the audience. For the people who live in the linux world..they don't even need the browser...the can just run the script via command line from local/bin. However...I'm making this for the windows people that need a gui...and thus I don't think they'd like needed to "type in" a directory...although mabye if I find a way to do tab completion.

Anyhow...there dosen't seem to be any easy way to get the user to just browse and select a directory....this is going to be a problem. >.<

DaWei Jun 4th, 2006 8:17 PM

Perhaps I'm wrong. I don't think you have your ducks all in a row. But fire away, Gridley, ammo's cheap.


All times are GMT -5. The time now is 1:51 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC