cancel
Showing results for 
Search instead for 
Did you mean: 

svg file uploads result in disallowed file type message?

svg file uploads result in disallowed file type message?

Hello

 

Hoping someone can help me out...

I am unable to upload svg files to my magento admin (currently trying for logo and favicon). each time I receive the error message - Disallowed file type?

 

I am using the Porto theme, but have disabled this and tried using the default Luma, but I get the same result so do not think it is a theme issue.

I am using Magento 2.1.9.

I have checked the following file - vendor/magento/module-cms/etc/di.xml and can see

<item name="svg" xsi:type="number">1</item>

as follows:

<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="svg" 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 name="svg" 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="svg" 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>

I have also contacted our host to check these file types are allowed and setup correctly to accept.

 

I am fairly new to Magento and would appreciate any help I can get in regards to resolving this issue.

Thank you.

4 REPLIES 4

Re: svg file uploads result in disallowed file type message?

Hi James, did you ever mange to fix this issue? I have exactly the same configuration and I'm unable to upload SVG files in admin. I get the error "Disallowed file type." but i know everything is setup correctly and I'm sure this worked in previous versions. I am using version Magento 2.2.2.

 

Can anyone assist with this? Thanks in advance.

Re: svg file uploads result in disallowed file type message?

As per the details available on GIT.

 

SVG format was intentionally removed due to security reasons:

Refer https://magento.com/security/patches/magento-2016-and-219-security-update APPSEC-1673: Stored xss using svg images in Favicon.

You can get the idea how to enable it back in your custom module by searching "svg" in 2.1.8...2.1.9.

Re: svg file uploads result in disallowed file type message?

Hi,

 

Here you can find a free extension that adds the possibility to upload SVG images in Magento 2: https://github.com/MagestyApps/module-web-images

 

It allows uploading SVG files in several Magento sections:

- on product/category pages;

- in static blocks and pages;

- when uploading theme files like logo and favicon;

Re: svg file uploads result in disallowed file type message?

Hi

You have to comment <svg>svg</svg> tag under <protected_extensions> in below xml file.

vendor/magento/module-store/etc/config.xml

 

magento-forum.png

 

Thanks