You are here: directory access and file locations « PHP Programming Language « IT news, forums, messages
directory access and file locations

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация