So I have a model that handles some slides I have in the page. My problem is having a fail safe in case the file doesn't delete. What would I have to return so the delete method only runs once the on_before_delete succeeds?
Also I'm having a bit of a problem with saving a file I get "You did not select a file to upload." as an error message. Basically the only thing I did was:
I might not be understanding correctly, but for a fail safe, couldn't you just return true or false from on_before_delete and then in the delete method pass in that variable and check to see whether it's true or false?
I thought maybe the delete method might check what the result of on_before_delete is. Also any help with my second problem with the insert? That would be great. Thanks in advance.
The on_before_delete() hook doesn't check for anything returned... it just runs (see line 1194 of MY_Model).
With regards to the saving issue, I wasn't able to replicate that problem locally. Are you using another model hook to process the file? That error is thrown by the CI's Upload class.
Comments
function form_fields($values = array(), $related = array()) {
$fields = parent::form_fields($values, $related);
$fields['file']['type'] = 'file';
return $fields;
}
Am I possibly doing something wrong?
With regards to the saving issue, I wasn't able to replicate that problem locally. Are you using another model hook to process the file? That error is thrown by the CI's Upload class.