Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Properly viewing SVG files after attached, (Using FileUpload)

AnorocAnoroc New
edited May 2012 in Vanilla 2.0 - 2.8

Hi Everyone,

I've just setup and started working with my new forum and I'm having an issue properly displaying SVG files that have been attached to a discussion. I'm currently using FileUpload, which allows me to attach an SVG, but it only shows as code. What I need it to do is allow users to click and download the file.

Does anyone have any insight regarding this?

Thanks!

Best Answer

  • 422422 Developer MVP
    Answer ✓

    in fileupload plugin , class.fileupload.plugin.php

    line 389

    if (in_array(strtolower(pathinfo($Filename, PATHINFO_EXTENSION)), array('bmp', 'gif', 'jpg', 'jpeg', 'png')))
             $ServeMode = 'inline';
    

    perhaps add , 'svg'

    and the same in class.mediamodel.php line 47

    if (!in_array(strtolower(pathinfo($Path, PATHINFO_EXTENSION)), array('bmp', 'gif', 'jpg', 'jpeg', 'png')))
    

    perhaps add , 'svg'

    There was an error rendering this rich post.

Answers

  • 422422 Developer MVP

    in config have you allowed svg file attachments ?

    There was an error rendering this rich post.

  • AnorocAnoroc New
    edited May 2012

    I have, which works. It just doesn't handle them correctly. Here's a link:

    http://knkusa.com/forums/discussion/1/felt-samples#Item_3

    It just shows up as code, instead of allowing to download the file.

    Thanks!

  • 422422 Developer MVP
    Answer ✓

    in fileupload plugin , class.fileupload.plugin.php

    line 389

    if (in_array(strtolower(pathinfo($Filename, PATHINFO_EXTENSION)), array('bmp', 'gif', 'jpg', 'jpeg', 'png')))
             $ServeMode = 'inline';
    

    perhaps add , 'svg'

    and the same in class.mediamodel.php line 47

    if (!in_array(strtolower(pathinfo($Path, PATHINFO_EXTENSION)), array('bmp', 'gif', 'jpg', 'jpeg', 'png')))
    

    perhaps add , 'svg'

    There was an error rendering this rich post.

  • Thanks! I gave this a shot. I can now right click the icon to download (by right clicking) which I think is more than acceptable.

    Thanks for the help!

Sign In or Register to comment.