Yeah, that's what I don't get. It says the file doesn't exist, yet the file does exist. It is listed in the file manager, it's editable and shows "nobody" as the group and owner.
Here is a shortened version of what happens:
//Set the path and read the directory
$newpath = substr($path.$pathext, 0, -1); //remove the forward or backwards slash from the end of the path
if ($dir = @opendir($newpath)) {
/* loop once for each name in the directory */
$fc=0;
while (false !== ($file = readdir($dir))) {
…
// get some stat info about the file and assign each part to an array
$filedata = stat($newpath.'/'.$file); // get some info about the file
$fileattrib[$fc][0] = $file; // file name
$fileattrib[$fc][1] = $filedata[7]; // size in bytes
$fileattrib[$fc][2] = $filedata[9]; // time of last modification
$fileattrib[$fc][8] = $filedata[4]; // file owner
$fileattrib[$fc][9] = $filedata[5]; // file group
…
// get the permissions for the file and convert to rwx format
$filepermissions = GetFilePerms($file);
// $filepermissions = GetFilePerms($fileattrib[$i][0]); tried this the first time and it didn’t work either
…
Here is the function I call:
function GetFilePerms($file) {
$p_bin = substr(decbin(fileperms($file)), -9) ; // This is the line that gives the warning
$p_arr = explode(".", substr(chunk_split($p_bin, 1, "."), 0, 17)) ;
$perms = "";
$i = 0;
foreach ($p_arr as $this) {
$p_char = ( $i%3==0 ? "r" : ( $i%3==1 ? "w" : "x" ) );
$perms .= ( $this=="1" ? $p_char : "-" ) . ( $i%3==2 ? " " : "" );
$i++;
}
return $perms;
}
To complicate the problem, this works in my script directory with no hitches at all. It also works in the subdirectories if I copy or move the file there, but not if I create it there. Also, what I don’t understand is the warning, it gives the file name of the file that supposedly doesn’t exist. I don’t understand why it says it doesn’t exist but it can read the file name…it’s just weird to me.