Magento 1 did not allow you to upload pdf files out-of-the box and they kept this bug feature in Magento 2. Here I show you how to allow it again.

screen-shot-2016-11-04-at-12-29-44-pm

I’m taking in consideration you already have a custom module created and in place (e.g. app/code/YOUR_MODULE/YOUR_PACKAGE/. Now, in your folder etc, create a file called di.xml (if it doesn’t exist already) and add the following content:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Cms\Model\Wysiwyg\Images\Storage">
        <arguments>
            <argument name="resizeParameters" xsi:type="array">
                <item name="height" xsi:type="number">75</item>
                <item name="width" xsi:type="number">100</item>
            </argument>
            <argument name="extensions" xsi:type="array">
                <item name="allowed" xsi:type="array">
                    <item name="jpg" xsi:type="number">1</item>
                    <item name="jpeg" xsi:type="number">1</item>
                    <item name="png" xsi:type="number">1</item>
                    <item name="gif" xsi:type="number">1</item>
                    <item name="pdf" xsi:type="number">1</item>
                </item>
                <item name="image_allowed" xsi:type="array">
                    <item name="jpg" xsi:type="number">1</item>
                    <item name="jpeg" xsi:type="number">1</item>
                    <item name="png" xsi:type="number">1</item>
                    <item name="gif" xsi:type="number">1</item>
                </item>
                <item name="media_allowed" xsi:type="array">
                    <item name="flv" xsi:type="number">1</item>
                    <item name="swf" xsi:type="number">1</item>
                    <item name="avi" xsi:type="number">1</item>
                    <item name="mov" xsi:type="number">1</item>
                    <item name="rm" xsi:type="number">1</item>
                    <item name="wmv" xsi:type="number">1</item>
                    <item name="pdf" xsi:type="number">1</item>
                </item>
            </argument>
            <argument name="dirs" xsi:type="array">
                <item name="exclude" xsi:type="string"/>
                <item name="include" xsi:type="string"/>
            </argument>
        </arguments>
    </type>
</config>

This content would be in “app/code/YOUR_MODULE/YOUR_PACKAGE/etc/di.xml”. And, as you can see, I’ve added for the extensions and media_allowed blocks the value pdf and will overwrite the settings in vendor/magento/module-cms/etc/di.xml.

Now if you clean the cache (command below) you should be able to upload your PDFs.

$ php bin/magento cache:clean

Happy Coding!

Magento 2: enable pdf uploadhttps://i0.wp.com/blog.mdnsolutions.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-04-at-12.29.44-PM.png?fit=704%2C182&ssl=1https://i0.wp.com/blog.mdnsolutions.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-04-at-12.29.44-PM.png?resize=150%2C150&ssl=1Renato MedinaMagentoMagento 2Magento 1 did not allow you to upload pdf files out-of-the box and they kept this bug feature in Magento 2. Here I show you how to allow it again. I'm taking in consideration you already have a custom module created and in place (e.g. app/code/YOUR_MODULE/YOUR_PACKAGE/. Now, in your folder etc, create...A Magento Craftsman in Melbourne