I am new to drupal 7, I am trying to create hook_file_presave / hook_file_validate / hook_field_validate function, That checks if pdf file that is uploaded on site is not password protected.
I can easily check using php if file is password protected. But when I display error message, it only displays error message also uploads file. I think i am not using right hook.
function simpletest_file_presave($destination){
// here is my logic
drupal_set_message(t('file is encrypted >>>>>>>> '. $filename), 'error');
return;
}
Here you can see file shouldn't be uploaded buit its there with remove button.