Welcome Guest, Not a member yet? Register   Sign In
Stop user from deleting a set file name not working
#1

I have a file in two locations called no_image.jpg When user try's to delete the image I would like to be able to stop the user from deleting just that image.

But for some reason the image still gets delete How can I make it stop deleting image if file is no_image.png


PHP Code:
public function delete() {
 
       $json = array();

 
       if (!$json) {

 
           foreach ($this->input->post('path') as $path) {
 
               $no_image_check $this->config->item('image_path') . 'catalog/no_image.jpg';
 
               $no_image_cache_check $this->config->item('image_cache_path') . 'catalog/no_image.jpg';

 
               if (isset($no_image_check)) {
 
                   $json['error'] = 'You cannot remove this image';
 
               }

 
               if (isset($no_image_cache_check)) {
 
                   $json['error'] = 'You cannot remove this image';
 
               }

 
               if (is_dir($this->config->item('image_path') . $path)) {
 
                   rmdir($this->config->item('image_path') . $path);
 
                   rmdir($this->config->item('image_cache_path') . $path);
 
               } elseif (is_file($this->config->item('image_path') . $path)) {
 
                   unlink($this->config->item('image_path') . $path);
 
                   unlink($this->config->item('image_cache_path') . $path);
 
               }
 
           }

 
           $json['success'] = 'Your Selected File Has Been Removed!';
 
       }

$this->output->set_content_type('Content-Type: application/json');
$this->output->set_output(json_encode($json));



Any examples on how to solve it would be great.
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply


Messages In This Thread
Stop user from deleting a set file name not working - by wolfgang1983 - 10-10-2015, 12:26 AM



Theme © iAndrew 2016 - Forum software by © MyBB