0

In the folder "scanner ()" whether screening, after "unlink ()" and I do unenroll ,If deleting the files in the folder, but I am getting permission denied error :

Warning: unlink(path/.): Permission denied in unlink.php on line

Warning: unlink(path/..): Permission denied in unlink.php on line 

my unlink php code :

$Pscan = scandir("img/movieData/$m_folder/poster/");
     foreach($Pscan as $Pscan_name){
         unlink("img/movieData/$m_folder/poster/$Pscan_name");    
     }
Jongware
  • 22,200
  • 8
  • 54
  • 100
vciloglu
  • 526
  • 2
  • 7
  • 19
  • maybe this will help http://stackoverflow.com/questions/13594898/permission-denied-php-unlink – Jakob Jul 13 '16 at 10:00
  • I tried it but I could not – vciloglu Jul 13 '16 at 10:03
  • your php instance has not the needed rights to delete the files, if you using linux based system, check the rights for the file and who is the owner and und what user the php instance runs – fehrlich Jul 13 '16 at 11:38

1 Answers1

0

problem fixed :

$Pscan = scandir("img/movieData/$m_folder/poster/");
         foreach($Pscan as $Pscan_name){
             // fixed
             if($Pscan_name == '.' || $Pscan_name == '..'){
                   continue;
             }else{
                   unlink("img/movieData/$m_folder/poster/$Pscan_name");
             }   
         }
vciloglu
  • 526
  • 2
  • 7
  • 19