• Resolved yokuraki

    (@yokuraki)


    On a customized register page, I added a file upload field and it is working well with a PDF file. What I want is to make it possible with a DOCX file to upload but it says “Sorry this is not a valid file”
    Is there any setting to restrict types of files for this plugin?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Towhid

    (@cryptex_vinci)

    Hi @yokuraki

    Insert this snippet in your themes functions.php

    add_filter( 'upload_mimes', 'yokuraki_extend_upload_mimes' );
    
     if( ! function_exists( 'yokuraki_extend_upload_mimes' ) ) {
    
        function yokuraki_extend_upload_mimes( $mimes ) {
            $mimes = array_merge(
                $mimes,
                array(
                    'docx'   => 'text/docx'
                )
            );
    
            return $mimes;
        }
    }

    Thanks

    Hi Asif,
    Thank you for your quickest reply. I add your code at the end of functions.php, however, the same error message still comes up at
    https://bridgesystem16.vinahosting.com/register/

    Towhid

    (@cryptex_vinci)

    Hi

    Check this out:

    function um_add_more_allowed_file_types( $allowed_types ) {
    
    	if( is_array( $allowed_types ) ) {
    		$allowed_types = array_merge( array(
    				'docx'	 => '.docx - docx Text',
    				), $allowed_types );
    	}
    
    	return $allowed_types;
    }
    add_action( 'um_allowed_file_types', 'um_add_more_allowed_file_types' );

    Thanks

    Thank you but it still does not work. The error message comes up at the upload splash screen.

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi,

    I’m closing this ticket temporarily due to inactivity. If you’re still having an issue/concern, just reply to this thread and mark this as “Not resolved” so we can continue assisting you.

    Regards,

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.