• Hello,

    By using this plugin we can restrict the mime-type files through contact form 7 file upload field?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author kimipooh

    (@kimipooh)

    Contact Form 7 implements its own MIME Type check, so it does not support that directly.
    This plugin controls the MIME Type check when uploading to WordPress media. If Contact form 7 uses to check MIME Type of WordPress core system for uploading to media, it will affect you, and if not, it will not affect you.

    Thread Starter navasahmed

    (@navasahmed)

    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.
    Plugin Author kimipooh

    (@kimipooh)

    Mime Type Check for Contact Form 7

    plugin, and here you can see that
    includes/class-cf7-mime-type-check-actions.php
    function cf7_custom_file_validation ($result, $tag)

    in includes/class-cf7-mime-type-check-actions-actions- php.
    I think it is a good idea to use this as a reference.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Working on contact from 7’ is closed to new replies.