SunQuest
 
           PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old August 9th, 2004, 04:25 PM
sharyn sharyn is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 32 sharyn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 53 m 17 sec
Reputation Power: 5
[SOLVED] directory select

I've been looking in different forums for this question and I haven't found it yet (unless I'm not typing in the right thing)... I'm trying to choose a directory to search. It sounds so simple, but I can't figure it out.

I'd like to be able to choose a directory to recurse through and list the files. I've got code to do that and it works just fine, but in order to choose a directory I am using the html <input type="file"...> command then hacking off the file name. Well that's not to handy and it's ugly as well, but how else can I do with a browse type look that everyone is used to?

Thanks,
sharyn

Last edited by sharyn : August 23rd, 2004 at 05:24 PM. Reason: solved

Reply With Quote
  #2  
Old August 9th, 2004, 11:21 PM
laidbak laidbak is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Location: In Tha IE -- San Bernardino COUNTY
Posts: 788 laidbak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 2 sec
Reputation Power: 7
Send a message via ICQ to laidbak Send a message via AIM to laidbak Send a message via MSN to laidbak Send a message via Yahoo to laidbak
Quote:
Originally Posted by sharyn
I am using the html <input type="file"...> command then hacking off the file name...

sharyn,

I am not sure what you are trying to accomplish. It sounds like you want to list the files of a directory on the server, however, you mention using an <input type='file'> element, which is intrinsically a client-side control.

What are you after?
__________________
__________________________________________________ _
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
Are You Listed...? | DigitallySmooth Inc.

Reply With Quote
  #3  
Old August 10th, 2004, 01:16 PM
sharyn sharyn is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 32 sharyn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 53 m 17 sec
Reputation Power: 5
Quote:
Originally Posted by laidbak
sharyn,

I am not sure what you are trying to accomplish. It sounds like you want to list the files of a directory on the server, however, you mention using an <input type='file'> element, which is intrinsically a client-side control.

What are you after?

LaidBak,

I've got a bunch of data that is either going to get copied to the server or stuck in a CD drive or is on a users computer and it has a bunch of directories that need to be recursed through to read the data. Since I don't know exactly where the data will sit, I want to ask the user to input the directory name. They could just type it in, but I'd really like to use the good old familiar common dialog box so even a computer illiterate user feels comfortable..

Was that a good enough explaination?

Reply With Quote
  #4  
Old August 10th, 2004, 02:14 PM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
There's no way to do this without writing an ActiveX control or some other plugin. The file browser widget will allow you to upload one file, and you should then be able to extract the path from the info sent to the server in the field, but there's no way for you to recurse the local directory structure from a simple Web script and have all the files uploaded or read. This has to be a client-side tool.
__________________
Please don't PM me asking for solutions outside the scope of a thread.
Keeping all responses in a thread stands to help others who come along later,
which is after all what this forum's all about.

Reply With Quote
  #5  
Old August 10th, 2004, 04:45 PM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 956 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 6 Days 8 h 23 m 34 sec
Reputation Power: 4
Send a message via ICQ to Itsacon
What you want might be possible, in IE though, as you can pretty much run a person's computer if he uses that piece of crap.
But seriously, just for a second image the enormous security hazard we would have if what you describe is possible.

Reply With Quote
  #6  
Old August 10th, 2004, 04:52 PM
sharyn sharyn is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 32 sharyn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 53 m 17 sec
Reputation Power: 5
Quote:
Originally Posted by Itsacon
What you want might be possible, in IE though, as you can pretty much run a person's computer if he uses that piece of crap.
But seriously, just for a second image the enormous security hazard we would have if what you describe is possible.

It's all inhouse for the data upload. It would just be me or a temp person sitting next to me doing this... if I can't trust myself, I'm in a heap of trouble

When it hits the outside world, the option will no longer be there.

Reply With Quote
  #7  
Old August 10th, 2004, 06:13 PM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 956 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 6 Days 8 h 23 m 34 sec
Reputation Power: 4
Send a message via ICQ to Itsacon
Like we said, the option isn't there because is MIGHT hit the outside world...

However, if it's on your own machine (so you want to transfer files on the system PHP is running on), just read the directory in a normal html text field, and use the fopen() function.

Reply With Quote
  #8  
Old August 10th, 2004, 06:18 PM
sharyn sharyn is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 32 sharyn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 53 m 17 sec
Reputation Power: 5
Itsacon,

That's what I'm trying to avoid, typing in each directory by hand. I'd like to be able to click on it and choose the directory. I've got probably over 500 different directories to get the data from , so a point and click is waaay better than typing anyday...

Reply With Quote
  #9  
Old August 11th, 2004, 03:20 AM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 956 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 6 Days 8 h 23 m 34 sec
Reputation Power: 4
Send a message via ICQ to Itsacon
Seems to me you need to go to another language. Most modern development kits have functions for what you want, and it sounds to me this isn't really a server-side thing anyway, so PHP just doesn't fit the bill.

Reply With Quote
  #10  
Old August 11th, 2004, 06:55 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
Yeah, Itsacon's right. Look into writing a little OCX that you can embed in a Web page. Or a little python app.

Reply With Quote
  #11  
Old August 11th, 2004, 09:29 AM
laidbak laidbak is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Location: In Tha IE -- San Bernardino COUNTY
Posts: 788 laidbak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 2 sec
Reputation Power: 7
Send a message via ICQ to laidbak Send a message via AIM to laidbak Send a message via MSN to laidbak Send a message via Yahoo to laidbak
You do not necessarily need to roll your own ocx, however, the current offerings are not cheap:
XFile... This software can take a local directory as a parameter and recurse through the subdirectories and upload everything it finds:
http://fileup.softartisans.com/default.aspx?PageID=122

If this works for you, I'd say purchase it and let it be done -- otherwise, the alternative option is to manually ftp the data to the server first, then, write a php script to recurse the directory structure on the server, and read the files you are looking for.

Reply With Quote
  #12  
Old August 23rd, 2004, 05:24 PM
sharyn sharyn is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 32 sharyn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 53 m 17 sec
Reputation Power: 5
I got this script from another forum and it works really well. You can see it work here and if you click on a file you can see the link at the top right to download the files. I used the "browse" function of this program and tweaked it a bit to make it work for me. The major thing I had to change was the use of $_SERVER['DOCUMENT_ROOT']. It doesn't seem to work for IIS. plus, I wanted to start at the root, not at Inetpub/wwwroot. But the rest of it works great thanks to Matthew Wilkin.

- sharyn

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > directory select


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |