|
Subject:
|
choose between two directories and use one
|
|
Posted By:
|
jjk2
|
Post Date:
|
5/17/2008 4:56:11 PM
|
i have something like this
$dir = array("http://www.asdf.com/files", "/var/www/html/videos");
how can i check both to see if a certain file exist in one of the two directories, and use whicheverone has it.
if both have the same file, then always use the first directory $dir[0]
I tried using foreach($dir as $directory) {} but all the url end up becoming
http://www.asdf.com/Array/files
where did the Array/ appear from ?
also, I have header(location:"http://www.asdf.com/file). how can i make it check both directories and choose whichever one has the specific file, if both have it, then put priority over the asdf.com directory.
thank you.
|
|
Reply By:
|
sdi126
|
Reply Date:
|
6/3/2008 5:07:39 PM
|
What you have should work?
foreach ($dir as $directory) { \\here you want to echo out directory not dir echo $directory .'<br />' \\you can check if the file/directory exists \\with the functions is_file() or is_dir() \\check php.net for usage }
free wifi | http://localwifisearch.com web dev | http://mynameissteve.com
|