Stop user from deleting a set file name not working |
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() { 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!
It looks like your "validation" is just checking if the variable $no_image_check is set, which it is on the previous line.
What you want to do is check if the actual file exists: http://php.net/manual/en/function.file-exists.php
(10-10-2015, 12:29 AM)JayAdra Wrote: It looks like your "validation" is just checking if the variable $no_image_check is set, which it is on the previous line. I have check boxes below each image though and user needs to have that check box checked before delete but need to make sure does not delete the no_image.jpg. I am also not sure if I have my json message in correct places. PHP Code: public function delete() {
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
After some more thinking about it I have got it all most working now.
In my foreach loop I have done a check like below. if ($this->config->item('image_path') . $path == $no_image_check) { PHP Code: public function delete() {
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
|
Welcome Guest, Not a member yet? Register Sign In |