|
Posted by eholz1 on 03/07/07 20:52
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
[Back to original message]
|