Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 2nd, 2006, 2:30 PM   #1
MegaArcon
Programmer
 
MegaArcon's Avatar
 
Join Date: Aug 2005
Posts: 66
Rep Power: 0 MegaArcon is an unknown quantity at this point
Allow user to select a directory

Hi all!

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!
__________________
Isn't that just the way life goes? If it's worth doing, it's NP-Hard. Todd Wareham - Memorial University of Newfoundland
MegaArcon is offline   Reply With Quote
Old Jun 2nd, 2006, 3:12 PM   #2
Agent 47
Hobbyist Programmer
 
Agent 47's Avatar
 
Join Date: Nov 2005
Posts: 122
Rep Power: 4 Agent 47 is on a distinguished road
Only way I can think of is with a Java Applet.
__________________
"I'm going to become rich and famous when I invent a device that allows you to stab people in the face over the internet"
Agent 47 is offline   Reply With Quote
Old Jun 2nd, 2006, 3:27 PM   #3
MegaArcon
Programmer
 
MegaArcon's Avatar
 
Join Date: Aug 2005
Posts: 66
Rep Power: 0 MegaArcon is an unknown quantity at this point
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!
__________________
Isn't that just the way life goes? If it's worth doing, it's NP-Hard. Todd Wareham - Memorial University of Newfoundland
MegaArcon is offline   Reply With Quote
Old Jun 2nd, 2006, 5:21 PM   #4
crawforddavid2006
Expert Programmer
 
crawforddavid2006's Avatar
 
Join Date: Apr 2005
Location: Not sure yet
Posts: 595
Rep Power: 0 crawforddavid2006 is an unknown quantity at this point
Send a message via AIM to crawforddavid2006 Send a message via MSN to crawforddavid2006
Why not Java Script?
__________________
Quote:
Originally Posted by DaWei View Post
Well, it's better than Pen Islands url....;)

crawforddavid2006 is online now   Reply With Quote
Old Jun 3rd, 2006, 6:20 AM   #5
Agent 47
Hobbyist Programmer
 
Agent 47's Avatar
 
Join Date: Nov 2005
Posts: 122
Rep Power: 4 Agent 47 is on a distinguished road
Quote:
Originally Posted by crawforddavid2006
Why not Java Script?
You can't interact with the user's file system using JavaScript.
__________________
"I'm going to become rich and famous when I invent a device that allows you to stab people in the face over the internet"
Agent 47 is offline   Reply With Quote
Old Jun 3rd, 2006, 6:30 AM   #6
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
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.
Arevos is offline   Reply With Quote
Old Jun 3rd, 2006, 11:29 AM   #7
a thing
Unverified User
 
a thing's Avatar
 
Join Date: Aug 2005
Location: none
Posts: 146
Rep Power: 0 a thing is on a distinguished road
You could just have the user type in the directory.
__________________
Warning: My posts may change (dramatically) within the first 15 minutes they're posted.
Got 'Nux?—GNU/Linux and other free software support.
It's GNU/Linux, not just Linux.
a thing is offline   Reply With Quote
Old Jun 3rd, 2006, 12:06 PM   #8
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Jun 4th, 2006, 8:55 PM   #9
MegaArcon
Programmer
 
MegaArcon's Avatar
 
Join Date: Aug 2005
Posts: 66
Rep Power: 0 MegaArcon is an unknown quantity at this point
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. >.<
__________________
Isn't that just the way life goes? If it's worth doing, it's NP-Hard. Todd Wareham - Memorial University of Newfoundland
MegaArcon is offline   Reply With Quote
Old Jun 4th, 2006, 9:17 PM   #10
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Perhaps I'm wrong. I don't think you have your ducks all in a row. But fire away, Gridley, ammo's cheap.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:35 AM.

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