Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP Deleting a full folder
    primarykey
    data
    text
    <p>I have the following function that I am trying to use to delete a full folder but it does not seem to be deleting any ideas or recommendations?</p> <pre><code>public function submit() { $location = $_SERVER['DOCUMENT_ROOT'].'/_assets/quote/uploads/'; $folderName = $this-&gt;quote-&gt;getCompanyDetails()-&gt;companyName; $data['companyContact'] = $this-&gt;quote-&gt;getCompanyDetails()-&gt;companyContact; $this-&gt;load-&gt;view('submit',$data); $this-&gt;quote-&gt;removeQuote(); if(is_dir($location.$folderName) === TRUE) { $files = array_diff(scandir($location.$folderName), array('.','..')); foreach($files as $file) { Delete(realpath($location.$folderName).'/'. $file); } return rmdir($location.$folderName); } else if(is_file($location.$folderName) === TRUE) { return unlink($location.$folderName); } return FALSE; } </code></pre> <p><strong>Update:</strong></p> <pre><code>public function submit() { $location = $_SERVER['DOCUMENT_ROOT'].'/_assets/quote/uploads/'; $folderName = $this-&gt;quote-&gt;getCompanyDetails()-&gt;companyName; $data['companyContact'] = $this-&gt;quote-&gt;getCompanyDetails()-&gt;companyContact; $this-&gt;load-&gt;view('submit',$data); //$this-&gt;quote-&gt;removeQuote(); $this-&gt;removeFolder(); } private function removeFolder(){ $location = $_SERVER['DOCUMENT_ROOT'].'/_assets/quote/uploads/'; $folderName = $this-&gt;quote-&gt;getCompanyDetails()-&gt;companyName; foreach(glob($location.$folderName.'/*') as $file) { if(is_dir($location.$folderName)) { rmdir($location.$folderName); }else{ unlink($location.$folderName); } rmdir($location.$folderName); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload