Home Forums Plugin Support WP User Frontend Pro File Type Restriction

This topic is: not resolved

This topic contains 3 replies, has 2 voices, and was last updated by  towhid 3 years, 10 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #70958

    saku4388
    Participant
    Post count: 23

    Hi,

    is there any way to restrict file upload to only accept .doc format

    Thanks

    #71110

    towhid
    Participant
    Post count: 4505

    Hello Shabir,

    Please paste this code at the bottom of the theme's functions.php file. It will be better if you create a child theme. Then this code will be intact if an update comes up for a parent theme.

    add_filter( 'wpuf_allowed_extensions', 'booking_text_cb' );
    function booking_text_cb( $extesions ){
        $extesions = array(
            'images' => array('ext' => 'jpg,jpeg,gif,png,bmp', 'label' => __( 'Images', 'wpuf' )),
            'audio' => array('ext' => 'mp3,wav,ogg,wma,mka,m4a,ra,mid,midi', 'label' => __( 'Audio', 'wpuf' )),
            'video' => array('ext' => 'avi,divx,flv,mov,ogv,mkv,mp4,m4v,divx,mpg,mpeg,mpe', 'label' => __( 'Videos', 'wpuf' )),
            'pdf' => array('ext' => 'pdf', 'label' => __( 'PDF', 'wpuf' )),
            'office' => array('ext' => 'doc', 'label' => __( 'Office Documents', 'wpuf' )),
            'zip' => array('ext' => 'zip,gz,gzip,rar,7z', 'label' => __( 'Zip Archives' )),
            'exe' => array('ext' => 'exe', 'label' => __( 'Executable Files', 'wpuf' )),
            'csv' => array('ext' => 'csv', 'label' => __( 'CSV', 'wpuf' ))
        );
        return $extesions;
    }

    Thanks

    #71299

    saku4388
    Participant
    Post count: 23

    Hi,

    But this is not working

    Please check here http://44dicndri.in/abstract-submission/ in abstract field.

    Try to upload a text file and it is not giving me any warning but try to upload a image file it gives an error like “You have uploaded an incorrect file type. Please try again.”

    Also i just want to restrict this on Abstract field not on any other.

    #72001

    towhid
    Participant
    Post count: 4505

    Please provide your login details(also FTP) by using this form: http://wedevs.com/provide-login-details/. I will have a look what is going wrong.

    Thank you ๐Ÿ™‚

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘File Type Restriction’ is closed to new replies.