Copied to clipboard

Flag this post as spam?

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


  • Anju 12 posts 32 karma points
    Jan 06, 2016 @ 12:47
    Anju
    0

    Restricting files in media folder

    Hi,

    Is there any way to restrict uploading files inside media folder.

    I can see an option inside UmbracoSettings.Config

    <disallowedUploadFiles>ashx,aspx,ascx,config,cshtml,vbhtml,asmx,air,axd,swf,xml,html,htm,svg,php,htaccess</disallowedUploadFiles>
    

    Actually I need to upload only .jpg,.png,.jpeg,.gif files only.

    So,it will be difficult to specify all the file types inside "disallowedUploadFiles".

    Please help me ASAP.

    Thanks in advance

    Anju

  • Luc van Soest 13 posts 148 karma points
    Jan 06, 2016 @ 13:31
    Luc van Soest
    0

    You should set the maxRequestLength in your web.config

     <configuration>
      <system.web>
        <httpRuntime maxRequestLength="xxx" />
      </system.web>
    </configuration>
    

    https://msdn.microsoft.com/en-us/library/e1f13641(v=vs.85).aspx

    For IIS7 and higher I believe you should include the following in your web.config

     <system.webServer>
        <security>
          <requestFiltering>
            <requestLimits maxAllowedContentLength="52428800" /> 
          </requestFiltering>
        </security>
      </system.webServer>
    
  • Richard Soeteman 4054 posts 12927 karma points MVP 2x
    Jan 07, 2016 @ 07:45
    Richard Soeteman
    0

    Hi Anju,

    What you could do is use saving event of the mediaservice (see https://our.umbraco.org/documentation/reference/events/mediaservice-events )

    Then you can cancel the save when the file doesn't have the correct extension.

    Best,

    Richard

  • 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.

Please Sign in or register to post replies