I was getting 500 errors:
Uncaught ArgumentCountError: Too few arguments to function my_acf_upload_prefilter(), 1 passed in xxx/wp-includes/class-wp-hook.php on line xxx and exactly 3 expected
because this line:
add_filter('acf/upload_prefilter/name=my_acf_upload_fieldname', 'my_acf_upload_prefilter');
needs the number of parameters:
add_filter('acf/upload_prefilter/name=my_acf_upload_fieldname', 'my_acf_upload_prefilter', 10, 3);