Hello fellow coders,
this is probably a tiresome topic for many of the more competent designers, but I am again confronting a “failed to open stream:permission denied” message when trying to create a directory.
One file creates a directory and allows the upload of pictures into it. No problems here. But another file allows the viewer to change the name of the folder and up load different pictures. In this program, I get the permission denied problem when the routine hits the creation of a new directory.
In trying to attack the problem I am trying to use functions to tell me the various kinds of information on the file; but these functions too are giving me problems.
For example, in the first part of the process where I am not having any problems, I tried to use the following functions to see what the file owner and permissions were at time of creation of the directory:
…because the picture folder name is the product item name, I check to make sure it is unique
… then
if($num>0) {
echo ‘<div class=”error_occur”><h3>The part name you have chosen is already in use; please choose a different name.</h3></div>’;
exit(‘duplicate picture file name has occurred’);
}
else
{
mkdir($pic_folder, 0777);
}
opendir($pic_folder);
$cur_dir=basename($pic_folder);
$user=fileowner($cur_dir);
echo ‘<h3>The file user is:’.’ ‘.$user[‘name’].'</h3>’;
echo ‘<h3>The file permissions are:’.’ ‘.decoct(fileperms($cur_dir)).'</h3>’;
the error message says fileowner(..) failed and fileperms failed and the printed line says file permissions are : 0
Anyone have any suggestions?
captsig