WordPress.org

Support

Support » How-To and Troubleshooting » Cannot upload .APK file for security reasons?

Cannot upload .APK file for security reasons?

  • Hi,

    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?

    Thanks

Viewing 1 replies (of 1 total)
  • 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' );
Viewing 1 replies (of 1 total)
  • The topic ‘Cannot upload .APK file for security reasons?’ is closed to new replies.