How can I change the allowed filetypes for Product Download ?

I would like to sell not only PDFs but MOBI and EPUB files on my MarketPress installation. Better still, be able to sell them all bundled in a ZIP file. How can I change the ‘allowed filetypes’ in MarketPress to reflect the kinds of files I want to sell as a product download?

  • Alexander
    • DEV MAN’s Mascot

    Hi @tracy,

    MarketPress can actually use a link to any file. There isn’t a restriction on the file type. You could upload them using FTP and copy/paste the link into MarketPress.

    The problem is with the WordPress uploader. It will only allow certain file extensions. Some custom code is needed to enable more.

    This snippet will add .zip support:

    add_filter('upload_mimes','add_custom_mime_types');
    function add_custom_mime_types($mimes){

    $new_file_types = array (
    'zip' => 'application/zip'
    );

    return array_merge($mimes,$new_file_types);
    }

    You can place this code in functions.php of a theme (or Child Theme), in your own plugin, or using something like Code Snippets.

    Best regards,

  • Levent
    • Design Lord, Child of Thor

    Hei Im having the same problem;

    Ive tried to the function in a child function, then tried the code snippets app, still i cant get marketpress to let me download .zip files after purchase… (not running multisite).

    What can i do? Kinda desperate here…

    Thanks,

    Best regards,

    Levent

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.