Thanks for your reply.
I have one doubt. if you can help please help me. am using this code for validating the mime. but when am trying the code. the file path can’t readable in WordPress. in core file it’s working.
add_filter('wpcf7_validate_file*', 'cf7_custom_file_validation', 10, 2);
add_filter('wpcf7_validate_file', 'cf7_custom_file_validation', 10, 2);
function cf7_custom_file_validation ($result, $tag) {
if ($tag->name === 'file-234') {
$filepath =$_FILES['file-234']['tmp_name']; // var_dump(mime_content_type($filepath));
$contentType = mime_content_type($_FILES['file-234']['tmp_name']);
if ($contentType !== 'application/pdf')
{
$result->invalidate($tag, 'This file type is not supported');
}
}
return $result; }
-
This reply was modified 2 years, 1 month ago by navasahmed.
-
This reply was modified 2 years, 1 month ago by navasahmed.