Copied to clipboard

Flag this post as spam?

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


  • Jenni 2 posts 72 karma points
    Apr 11, 2017 @ 04:44
    Jenni
    0

    Upload limits for different file types?

    Hey there, I've been searching around for an answer on this but I can't find anything definitive. I want to somehow restrict file uploads depending on the file type/extension being uploaded.

    For example, I want to have a different file limit for .jpg files than for .mp3 files. Is this possible at all?

    At the moment we have a rather large limit in the maxRequestLength attribute in the web.config because our users upload mp3s through our CMS. The issue is, they are then able to upload larger images than we would like.

    Any ideas or suggestions would be greatly appreciated!

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Apr 24, 2017 @ 18:00
    Jan Skovgaard
    1

    Hi Jenni - Welcome to our :)

    Did you manage to find a solution for this issue already? Otherwise I hope my 2 cents can help.

    I don't think this is possible to tweak using the web.config - But when I read your issue I wondered whether perhaps pre processing the images when the editors are uploading them could help?

    If you're using Umbraco 7.1 or later then you should be able to cut some of the fat from the images on the upload event by pre-processing them following the advice from James Jackson-South in this article from 2014 http://24days.in/umbraco-cms/2014/all-your-images-are-belong-to-umbraco/

    The first part of the article is about some of the possible post-processing techniques that are possible for serving the most optimized image for the end users but the gist is that it's possible to shave more KB's of the images by pre-processing them, which he writes about further down in the article under the headline "Pre processing".

    If I understand your issue correctly then this could be a solution for you perhaps?

    Hope this helps.

    /Jan

  • Jenni 2 posts 72 karma points
    Apr 26, 2017 @ 01:17
    Jenni
    0

    Hey Jan! Thanks :)

    No unfortunately I'm yet to find the ideal solution to my problem.

    Thanks for that - yes I already looked at that very article and had a play with pre-processing. It's pretty helpful, but I was more looking for a way to check the file size against the extension before upload. Which, I've learned, I cannot do. We also thought about a solution where we could upload a file, check it, then delete if it doesn't meet our criteria, but it got a bit complicated.

    So after that, I went through trying to get errors popping up when you try to upload files with specific extensions, but all in all, because I can't seem to get the file's size before it's uploaded, none of this really solved what my product team wanted.

    Our next step is to do a discovery around using Angular to check the files before upload, and display some kind of notification to the user. We are also looking at storing our larger files (e.g. .mp3) elsewhere so we don't have to go through the Umbraco media folder and avoid the file upload limit altogether.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

    Continue discussion

Please Sign in or register to post replies