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!

How to choose a directory

Status
Not open for further replies.

mhamilton3

Programmer
Joined
Oct 31, 2001
Messages
129
I want to allow a user to choose a directory from a standard browse list and have that directory passed back so I can parse through the list of files to FTP them. Even better would be if I could pass the directory to a utility to FTP the whole directory. I am not a PHP guru so I'm not sure if this functionality is already build in. Any help would be much appreciated. Thanks.
 
There is a host of directory handling functions in PHP.
All the functions you require for the desired functionality are in there.
Read:

FTP is also included:

You could also download the files using HTTP, just passing the correct header for encoding.
 
Thank you, but I am still missing one piece. Is there a function somewhere that will let me put up a browse button and traverse the directory structure to choose a directory. I know <input type='file'> with HTML will allow me to traverse the tree to get a specific file, but I want to get a specific directory. I think my problem is this is client side - meaning Javascript / not PHP. (the PHP functions and FTP functions will come in handy though, thanks)
 
I am not clear about which way the transfer is supposed to happen; Client -> server or Server -> client
 
The client will be uploading files to the server
 
You are right in your analysis - the problem is client side.
Since that is the case PHP can't help. The upload mechanism with the <input type=&quot;file&quot;> is to my best knowledge the only available source for your upload files.

FTP is not a solution, because your PHP server would need to contact the client's machine and it's unlikely people have an FTP server running - they might be behind a firewall anyway.

Also, you want to consider limiting the maximum size of upload files or your server could be maliciously plastered with junk.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top