Hi all,
I have a simple form with a file upload and I’m attempting to intercept it with the ‘upload_prefilter’ filter, but it’s just not working!
My code is as follows:
function my_acf_upload_prefilter( $errors, $file, $field ) {
$errors[] = 'computer says no';
// return
return $errors;
}
add_filter('acf/upload_prefilter/name=unique_upload_image', 'my_acf_upload_prefilter');
I thought this would just cause the upload to fail for the field named ‘unique_upload_image’ – but it continues to work fine.
Am I doing something stupid here?
Thanks
Kevin
OK my bad, I was forgetting my namespacing!!!
Should have been:
add_filter('acf/upload_prefilter/name=unique_upload_image', '\App\my_acf_upload_prefilter');
However, although this now works, it’s still not displaying the error message I defined, it’s just saying ‘HTTP error’?
Any ideas?
Kev