Ready to get started?Download WordPress


Cannot upload .APK file for security reasons? (2 posts)

  1. bhdadmin
    Posted 9 months ago #


    We want to upload APK files onto our website, as we are creating a 'tablet resources' page for students at the school, but I cannot upload an APK file as it says it cannot be uploaded for security reasons. Is there any way around this security issue?


  2. Scriptrunner (Doug Sparling)
    Posted 9 months ago #

    APK isn't in the default list of allowed mime types for uploads, though I'm not sure if it's due to it being a relatively uncommon file type (except for Android developers) or for security reasons. (it does install software on Android devices)

    Never the less, if you want to upload an apk (I do it, as I'm an Android developer), add this to the functions.php file in your theme:

    function add_upload_mime_types( $mimes ) {
        if ( function_exists( 'current_user_can' ) )
            $unfiltered = $user ? user_can( $user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' );
        if ( !empty( $unfiltered ) ) {
            $mimes['apk'] = 'application/vnd.android.package-archive';
        return $mimes;
    add_filter( 'upload_mimes', 'add_upload_mime_types' );


You must log in to post.

About this Topic


No tags yet.