• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Delete folder

#1
hi , hi have a problem with folder deleting , this is my code :

Code:
        //carico l'helper
        $this->load->helper("file"); // load the helper

        //percorso della cartella
        $path='/uploads/'.$id_user.'/';

        //rimuovo i file
        if(! delete_files($path, true) ){

            $errori++ ;
            $data['messaggi_errore'] = $data['messaggi_errore'].' Problemi eliminazione file |';

        }

        //rimuovo la cartella
        if( rmdir($path) ) {

            $errori++ ;
            $data['messaggi_errore'] = $data['messaggi_errore'].' Problemi eliminazione cartella |';
        }

The file inside the folder are correcting delete but i have this warning :

Message: rmdir(/uploads/33/): No such file or directory

But in uploads i have the folder 33 ...
Reply

#2
Remove the trailing slash:
PHP Code:
$path='/uploads/'.$id_user;
rmdir($path); 
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.