Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Janet Kirklen 102 posts 212 karma points
    Apr 29, 2014 @ 00:28
    Janet Kirklen
    0

    Error Uploading SVG image to Media Section

    I have some .svg images that I need to upload to the Media Section.  If I use the Drag & Drop Upload then the image is uploaded but it it treated as a media type of "File" and not "Image".  The image is uploaded to the media section, but it is not accessible via  @Model.Media("brandLogo", "umbracoFile") .

    This site is running Umbraco 6.1.6.

    If I create the Media item individually with a Media Type of "Image" and then us "Choose File" to upload the image I get the following error:

    Parameter is not valid.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

    Exception Details: System.ArgumentException: Parameter is not valid.

    Source Error: 

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


    Stack Trace: 

    [ArgumentException: Parameter is not valid.]
       System.Drawing.Image.FromStream(Stream stream, Boolean useEmbeddedColorManagement, Boolean validateImageData) +1613412
       Umbraco.Core.IO.UmbracoMediaFile.GetDimensions() +93
       Umbraco.Core.IO.UmbracoMediaFile.Resize(Int32 maxWidthHeight, String fileNameAddition) +51
       umbraco.cms.businesslogic.datatype.FileHandlerData.set_Value(Object value) +1006
       umbraco.editorControls.uploadField.Save() +777
       umbraco.controls.ContentControl.SetNameAndDataTypeValues() +407
       umbraco.controls.ContentControl.SaveClick(Object sender, ImageClickEventArgs e) +17
       System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +134
       System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +204
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3804

     

    My umbracoSettings.config includes .svg as an image type:

     <imageFileTypes>jpeg,jpg,gif,bmp,png,tiff,tif,svg</imageFileTypes>

    I have checked my Mime Types.  Both IIS and my web.config specify this extension.  

      <staticContent>

          <remove fileExtension=".svg" />

          <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />

        </staticContent>

    Is there something else that needs to be done for svg images to work with Umbraco?

  • Chris Percival 6 posts 29 karma points
    Dec 12, 2014 @ 15:59
    Chris Percival
    0

    Did you ever solve this? Its still an issue in v7.2

  • Jan Skovgaard 11258 posts 23498 karma points MVP 7x admin c-trib
    Dec 12, 2014 @ 18:27
    Jan Skovgaard
    0

    Hi Guys

    I don't think that anyone has succeeded achieving this as media - Perhaps it would be a good idea to make a feature request for this at the issue tracker

    How are you going to use the .svg files? Is it for logos etc. or is it for content? Just wondering if it would be an absolute no go to upload as the "file" type as a workaround?

    /Jan

  • Chris Percival 6 posts 29 karma points
    Dec 12, 2014 @ 18:31
    Chris Percival
    1

    I raised this as a bug, svg should be supported. http://issues.umbraco.org/issue/U4-6008

  • Jan Skovgaard 11258 posts 23498 karma points MVP 7x admin c-trib
    Dec 12, 2014 @ 18:41
    Jan Skovgaard
    0

    Agreed - But just wondering if uploading as File would be a possible workaround. I have not been using .SVG graphics in my Umbraco sites yet so just curious :) (Voted the issue btw).

    /Jan

  • Chris Percival 6 posts 29 karma points
    Dec 15, 2014 @ 11:34
    Chris Percival
    0

    Jan, could you further explain 'uploading as File' please?

  • Jan Skovgaard 11258 posts 23498 karma points MVP 7x admin c-trib
    Dec 15, 2014 @ 11:38
    Jan Skovgaard
    0

    Hi Chris

    Sure - If you go into the media section and right click on a folder you can choose to manually create a file item from the dropdown that appears - Now try uploading your .svg file.

    Also make sure to add the proper SVG mime type in your web.config static settings so you make sure that the server knows about the correct mime type for dealing with it.

    /Jan

  • Chris Percival 6 posts 29 karma points
    Dec 16, 2014 @ 14:20
    Chris Percival
    0

    Ah, OK. That gives me the following exception:

     

    Received an error from the server

    An error occurred

    Parameter is not valid.

    Exception Details:
    System.ArgumentException: Parameter is not valid.
    Stacktrace:
    at System.Drawing.Image.FromStream(Stream stream, Boolean useEmbeddedColorManagement, Boolean validateImageData)
       at Umbraco.Web.PropertyEditors.FileUploadPropertyValueEditor.ConvertEditorToDb(ContentPropertyData editorValue, Object currentValue)
       at Umbraco.Web.Editors.ContentControllerBase.MapPropertyValues[TPersisted](ContentBaseItemSave`1 contentItem)
       at Umbraco.Web.Editors.MediaController.PostSave(MediaItemSave contentItem)
       at lambda_method(Closure , Object , Object[] )
       at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass13.<GetExecutor>b__c(Object instance, Object[] methodParameters)
       at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)
       at System.Threading.Tasks.TaskHelpers.RunSynchronously[TResult](Func`1 func, CancellationToken cancellationToken)
  • Jan Skovgaard 11258 posts 23498 karma points MVP 7x admin c-trib
    Dec 16, 2014 @ 14:32
    Jan Skovgaard
    0

    Hi Chris

    Hmm, does it work if you try uploading something else? Like a PDF, Word or Excel file?

    Just trying to figure out if it's for some reason failing when trying to upload certain file types or if it's a general issue.

    /Jan

  • Chris Percival 6 posts 29 karma points
    Dec 16, 2014 @ 15:50
    Chris Percival
    2

    This issue is caused by having svg in the imageFileTypes list in umbracoSettings.config. Without svg in this list umbraco doesn't try creating a thumbnail from the avg and you're able to upload the image without error.

  • Jan Skovgaard 11258 posts 23498 karma points MVP 7x admin c-trib
    Dec 16, 2014 @ 16:42
    Jan Skovgaard
    0

    Hi Chris

    Aaah, nice catch - Did not think about that even though it's mentioned that it was added in the first post.

    So the issue should probably be changed as well in regards to that it should be possible to have thumbnails of .svg file rather than it's an issue uploading .svg files if it has not already been done.

    /Jan

  • Ali Sheikh Taheri 470 posts 1647 karma points c-trib
    Mar 08, 2016 @ 14:45
    Ali Sheikh Taheri
    2

    In Umbraco 7.4 I was still getting the same error so in order to allow SVG files to be uploaded to media section you need to remove SVG from <disallowedUploadFiles> tag in UmbracoSettings.config file.

    Ali

  • Tom Cowling 144 posts 342 karma points
    Sep 05, 2016 @ 10:09
    Tom Cowling
    0

    In Umbraco 7.4 I was still getting the same error so in order to allow SVG files to be uploaded to media section you need to remove SVG from

    Perfect!

    Perhaps someone from the Umbraco core team could comment on why it's disallowed in the first place? Seems strange to me that you'd want to disable something that's so commonplace now on the web these days.

  • aftab ahmed 3 posts 20 karma points
    Oct 20, 2017 @ 06:21
    aftab ahmed
    0

    I have removed it but i still have problem

  • Jordan Lane 28 posts 130 karma points c-trib
    May 13, 2016 @ 15:26
    Jordan Lane
    1

    I've submitted a PR to the issue which can be tracked here: http://issues.umbraco.org/issue/U4-6008

  • Jordan Heuten 3 posts 73 karma points notactivated
    Nov 16, 2017 @ 09:35
    Jordan Heuten
    0

    I can now upload .svg's, but I cannot select them with a picker :s anyone?

  • Marco Lusini 176 posts 1370 karma points
    Feb 23, 2018 @ 08:52
    Marco Lusini
    0

    Hi,

    did anybody managed to solve this one?

    Looks like a catch 22 situation: in order to be pick SVG files with a Media Picker we must to add SVG to the imageFileTypes list, but adding SVG to the imageFileTypes list rise an error when uploading SVG files...

    /M

  • Josh Reid 182 posts 257 karma points
    Jul 05, 2018 @ 02:19
    Josh Reid
    0

    How is this still an issue? Or is there any change?

    Surely a thumbnail could be created for an svg, or not generated and use the original file as the thumbnail view.

Please Sign in or register to post replies

Write your reply to:

Draft