CodeIgniter Forums

Full Version: Delete fle
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi , in a cronjob i try to delete some file from db ,the file are at the same position of application (uploads folder) :

this is my code :

PHP Code:
public function elimina_immagini_limbo(){

 
       $lista_in_attesa_approvazione=$this->immagini_model->lista_in_attesa_approvazione();

 
       foreach ($lista_in_attesa_approvazione->result() as $v) {

 
           $path=FCPATH 'uploads/' $v->img;

 
           if (file_exists$path)) {
 
               // Remove file
 
               if (delete_file$path)) {
                    
                    
//remove file form db
 
                   $res $this->immagini_model->
 
                       deleteImmagini($v->id);
                    

 
                   if ($res) {

 
                       $return_text '1';

 
                   } else {

 
                       // Set status
 
                       $return_text '0|' $path;
 
                   }

 
               } else {
 
                   $return_text '2|' $path;
 
               }

 
               
            
}else{

 
             $return_text='3|'.$path;
 
           }

 
         echo $return_text.'<br>';
 
           
        
}


 
   }




but result are :

Code:
3|/membri/my_site/uploads/15316643072017 bollo opel.jpg
3|/membri/my_site/uploads/1531664322foto_profilo.jpg
3|/membri/my_site/uploads/1531664335foto_profilo.jpg
3|/membri/my_site/uploads/1531664348foto_profilo.jpg
3|/membri/my_site/uploads/1531664369libretto stilo.jpeg
3|/membri/my_site/uploads/1531664381foto_profilo.jpg
3|/membri/my_site/uploads/1531664387libretto stilo.jpeg
3|/membri/my_site/uploads/1531665327foto_profilo.jpg
3|/membri/my_site/uploads/1531676442foto_profilo.jpg
3|/membri/my_site/uploads/15316764562017 bollo opel.jpg

How can i delete file ?
(07-17-2018, 09:14 AM)pippuccio76 Wrote: [ -> ]/membri/my_site/uploads/1531664322foto_profilo.jpg

Is that exact path where the file is?