|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
[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 |
|
#2
|
|||
|
|||
|
Quote:
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. |
|
#3
|
|||
|
|||
|
Quote:
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? |
|
#4
|
||||
|
||||
|
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. |
|
#5
|
||||
|
||||
|
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. |
|
#6
|
|||
|
|||
|
Quote:
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. |
|
#7
|
||||
|
||||
|
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. |
|
#8
|
|||
|
|||
|
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... |
|
#9
|
||||
|
||||
|
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.
|
|
#10
|
||||
|
||||
|
Yeah, Itsacon's right. Look into writing a little OCX that you can embed in a Web page. Or a little python app.
|
|
#11
|
|||
|
|||
|
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. |
|
#12
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > directory select |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|