469,636 Members | 1,955 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,636 developers. It's quick & easy.

directory access and file locations

Hello PHP group,

I have a question about file locations, and whether on not (in my
case, not) a page will execute depending
on the location of the php file.

I have a web devel server, with a directory below htdocs (using Apache
2.2 on Fedora Linux)
/usr/local/apache2/htdocs/portfolios and /usr/local/apache2/htdocs/
portfolios/setup

I thought it would be nice to put pages that involve moving files
around, adding data to a mysql database,
etc in a directory called "setup" I have another path /usr/local/
apache2/htdocs/portfolios/testimage
that I read with my page, and copy data from the testimage dir into a
database. I use code like below
$path = 'testimage';

$dir_handle = @opendir($path) or die("Unable to open directory
$path");

/*** Load an array with the list of files in the dir ***/
while ($file = readdir($dir_handle))
{
//$filetyp =getFileType($file); no good for all images???OR $filetyp
== 'gif'
$filetyp = strtolower(substr($file, -3));
if ($filetyp == 'jpg' )
{
$filecount++;
//***$handle = fopen($path . "/" . $file,'r');
$filelist[$idx] = $path . "/" . $file; //add file to array
//echo $filelist[$idx];
$idx++;
//***$file_content = fread($handle,filesize($path . "/" . $file));
//***fclose($handle);

}
}
closedir($dir_handle);

I use the echo command to see if the files in the dir are being read,
etc. this works when the php page is located in ..../portfolios, but
if i try to run the php page from ..../portfolios/setup, I do not read
any files.
I rename the path to "../testimage" to backout of the "setup"
directory. I am guessing I am not defining the path correctly? Also
just to be sure (intranet development site only) i open the
permissions on "testimage" so all can read and write and execute.
Even with that I return no file names.

What am I missing???

thanks,

ewholz

Mar 7 '07 #1
0 1129

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Tracy Tripp | last post: by
29 posts views Thread by DFS | last post: by
4 posts views Thread by =?Utf-8?B?SmVmZiBCZWVt?= | last post: by
2 posts views Thread by aaragon | last post: by
reply views Thread by DeskUser | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.