— Login —

Forgot Password?
Don't have an account? Register Now
WordPress Download Manager Pro Special Pack is available now!!!
WordPress Download Manager
  •   Home
  •   Pricing
  •   Demo
  •   Add-ons  
    •   All Ad-ons Pack
    •   All Add-ons
    •   Featured Add-ons
    •   eCommerce Add-ons
    •   Payment Gateways
    •   Cloud Storage
    •   Email
    •   Social Networking
    •   UI
    •   Widgets
    •   Tools
    •   Free
  •   Discount Packs
  •   Themes  
    •   Themes
    •   Free Themes
    •   All Themes Pack @ $59.00
  •   Docs  
    •   Download Manager Pro
    •   Premium Package
    •   WPDM Directory Add-on
    •   WPDM Newsletter
    •   WPDM WebHook
    •   WPDM iContact
    •   WPDM Constant Contact
    •   WPDM PDF Stamper
    •   WP Pro Membership
    •   Opt-in Magic
    •   Themes
    •   For Theme Developers
  •   Support  
    •   Search in Forum
    •   Download Manager Pro
    •   Download Manager Free
    •   Download Manager Pro Feature Request
    •   Contact Us
  •   Blog  
    •   How To
    •   Tips
    •   New Release
    •   Updates
    •   New Feature
    •   Add-on
  •   Earn  
    •   Affiliates Signup
    •   Affiliate Earnings
Contact Us Pre-Sale Query
Shopping Cart 0 item(s) ( $0.00 )
Hello, Guest Login / Register
 
  •   Home
  •   Pricing
  •   Demo
  •   Add-ons  
    •   All Ad-ons Pack
    •   All Add-ons
    •   Featured Add-ons
    •   eCommerce Add-ons
    •   Payment Gateways
    •   Cloud Storage
    •   Email
    •   Social Networking
    •   UI
    •   Widgets
    •   Tools
    •   Free
  •   Discount Packs
  •   Themes  
    •   Themes
    •   Free Themes
    •   All Themes Pack @ $59.00
  •   Docs  
    •   Download Manager Pro
    •   Premium Package
    •   WPDM Directory Add-on
    •   WPDM Newsletter
    •   WPDM WebHook
    •   WPDM iContact
    •   WPDM Constant Contact
    •   WPDM PDF Stamper
    •   WP Pro Membership
    •   Opt-in Magic
    •   Themes
    •   For Theme Developers
  •   Support  
    •   Search in Forum
    •   Download Manager Pro
    •   Download Manager Free
    •   Download Manager Pro Feature Request
    •   Contact Us
  •   Blog  
    •   How To
    •   Tips
    •   New Release
    •   Updates
    •   New Feature
    •   Add-on
  •   Earn  
    •   Affiliates Signup
    •   Affiliate Earnings

Using upload_mimes to allow upload and download of unrecognized mime type

Home Blog Blog Using upload_mimes to allow upload and download of unrecognized mime type

Some mime types are not listed with wordpress by default. For example .apk. So when you try to upload or download a file with unknown file type, sometimes it may not work properly, like problem with opening file after download. So in such cases you need to take some additional actions to make it work. WordPress has a filter hook “upload mimes” and this filter can be used to alter the list of acceptable file extensions ( introducing new file type or excluding any known file type ) WordPress checks during media uploads or sending mime-type / content type header to browser before staring download

Example Usage

To make use of this filter, you will need to place a function similar to the below in your theme’s functions.php file.

Firstly, add the following line of code to your theme’s functions.php file to show WordPress that you want to hook in to this filter –

add_filter('upload_mimes', 'wpdm_custom_mimes');

The first parameter is the filter name, the second paramter is the name of the function that you are going to create to alter the list (so you can name this as you like, so long as it matches the name in this next piece of code.)

Now for the real work – your function. This adds or removes the file types –

function wpdm_custom_mimes ( $existing_mimes=array() ) {

// Add file extension 'apk' with mime type 'application/vnd.android.package-archive'
$existing_mimes['apk'] = 'application/vnd.android.package-archive';

return $existing_mimes;

}

and now you will be able to upload/download .apk without any trouble.

  • Posted on Apr 29, 2014
  • By Shahjada
  • In Blog,Tips
  • Previous Next

Post Tags

allow file typeapk downloadapk uploaddownload managerfile manager

About The Author

Shahjada
About Me: http://shahjada.info/about-me/ .

Discussion

  • Malcolm Beyer

    I know this is an old article, but it’s relevant to me right now. I followed the steps and am still unable to download an .apk file. Anything new since this was posted I should be trying?

    Dec 21, 2017 at 8:38 pm Log in to Reply
    • Shafayet

      Please post in the forum.

      Dec 22, 2017 at 5:23 am Log in to Reply

Leave a Reply Cancel reply

You must be logged in to post a comment.

Subscribe

Delivered by FeedBurner

Categories

  • Add-on
  • Blog
  • How To
  • New Feature
  • New Release
  • Tips
  • Uncategorized
  • Updates

Archives

  • February 2019
  • January 2019
  • December 2018
  • November 2018
  • July 2018
  • June 2018
  • May 2018
  • April 2018
  • March 2018
  • February 2018
  • January 2018
  • December 2017
  • November 2017
  • September 2017
  • August 2017
  • June 2017
  • May 2017
  • April 2017
  • March 2017
  • February 2017
  • January 2017
  • November 2016
  • October 2016
  • June 2016
  • May 2016
  • April 2016
  • February 2016
  • January 2016
  • December 2015
  • October 2015
  • August 2015
  • May 2015
  • April 2015
  • March 2015
  • February 2015
  • January 2015
  • December 2014
  • November 2014
  • October 2014
  • August 2014
  • July 2014
  • June 2014
  • May 2014
  • April 2014
  • March 2014
  • February 2014
  • January 2014
  • December 2013
  • July 2013
  • June 2013
  • April 2013
  • February 2013
  • January 2013
  • December 2012
  • November 2012
  • June 2012
  • May 2012
  • April 2012
  • February 2012
  • December 2011
  • September 2011
  • August 2011
  • July 2011
  • June 2011
  • May 2011
  • April 2011
Download Manager

All in One Digital Resource Management & Complete eCommerce Solution for Selling Digital Products

  Protect Files & Documents
  Share Files & Documents
  Monitor File Downloads
  Promote Your Site Contents
  Sell Digital Products
Our Network
  • Apps Eden
  • Live Forms
  • Premium WordPress Themes and Plugins
  • Script Eden
Recent Posts
  • WordPress Download Manager Pro v4.9.1 is available for download now
  • WordPress Download Manager Pro v4.9.0 is available for download now
  • WordPress Download Manager Pro v4.8.1 is available for download now
Download Manager Blog
  • Blog
  • Add-on
  • How To
  • New Release
  • Updates
WordPress Download Manager
Terms & Conditions   |   Member of W3 Eden Network