U4-9349 - Media picker doesn't allow you to upload svg files even when the svg extension isn't in the disallowedUploadFiles element

Created by Tim Geyssens 06 Jan 2017, 13:31:41 Updated by andrei 03 Sep 2018, 14:11:42

What did you do?

Removed the svg file extension from the disallowedUploadFiles element in the umbracosettings.config

What did you expect to happen?

Be able to view and upload svg files in the media picker

What actually happened?

Still get the error Cannot upload this file, it does not have an approved file type

(works fine in the media section btw)

2 Attachments

Comments

Bjarne Fyrstenborg 20 Feb 2017, 15:08:41

Furthermore media picker doesn't allow existing svg files in media section to be picked.

in /config/umbracoSettings.config I have removed svg:

ashx,aspx,ascx,config,cshtml,vbhtml,asmx,air,axd,swf,xml,html,htm,php,htaccess

The mediapicker dialog shows these extensions: .jpeg,.jpg,.gif,.bmp,.png,.tiff,.tif while the upload in media section doesn't seem to retrict by using ngf-pattern attribute.

UPDATE: The Media Picker in the project has checked "pick only images". When I unchecked this I could pick the a SVG file and also upload SVG via mediapicker dialog. However it would be great to make it more flexible and blacklist or whitelist file extensions. And consider if SVG should be allowed, when checking "pick only images" and when it is removed from disallowedUploadFiles since it is a valid extension for element.


Barry Fogarty 09 Oct 2017, 11:36:52

Additionally, the media picker within the grid does not allow picking or uploading of SVG even with the settings you mention applied.

A related issue I also found, when referring to the following thread: https://our.umbraco.org/forum/umbraco-7/using-umbraco-7/74089-svg-files-in-the-media-library is that when SVG is included in the umbracoSettings image/imageFileTypes element, I get an unhandled exception when uploading SVGs to the media library:

Could not acquire actionExecutedContext.Response.Content System.NullReferenceException: Object reference not set to an instance of an object. at Umbraco.Web.WebApi.Filters.FileUploadCleanupFilterAttribute.OnActionExecuted(HttpActionExecutedContext actionExecutedContext)

It works fine when SVGs are treated as file uploads, with no thumbnail generation. I thought perhaps with this setting, the media pickers would recognise SVG as a valid image type. This may need splitting into its own separate issue, but I thought I would include here as is pertinent to the overall problem.


Aaron Macdonald 04 Apr 2018, 09:22:58

Has there been any progress on this issue?

We have a client on 7.5.14 who wants to use SVGs in the backend like any other image file.

As @Bjarne.Fyrstenborg said we can upload them as files but we cannot get them to be treated as media or recognised by media picker with "pick only images".

As @barryfogarty said we get the System.NullReferenceException if we try adding svg to the umbracoSettings.config image/imageFileTypes element.


andrei 03 Sep 2018, 14:11:42

Same problem here, any progress on the issue?


Priority: Normal

Type: Bug

State: Submitted

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 7.5.6, 7.5.8, 7.5.9

Due in version:

Sprint:

Story Points:

Cycle: