Copied to clipboard

Flag this post as spam?

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


  • Martin Aguirre 42 posts 210 karma points
    Jun 22, 2017 @ 13:30
    Martin Aguirre
    0

    Wrong Route of Umbraco Forms entries

    Hi everyone! Its me again. I've a little problem with routes in entry forms.

    Apparently some "virtual root" config in IIS cause some problems to access uploaded files.

    In form/entries/ when click in some item it doesn't show.

    The url requests and save in the DB is

    https://www.mydomain.com/media/forms/upload/Form_8926f6ea-872e-45a2-bc75-97c87220949d/cdd89b27-7693-4896-a7e1-5a4e22adfe87/270698.JPG
    

    but the Url that can access the file is

    https://www.mydomain.com/715_APP/media/forms/upload/Form_8926f6ea-872e-45a2-bc75-97c87220949d/cdd89b27-7693-4896-a7e1-5a4e22adfe87/270698.JPG
    

    enter image description here

    There are some config file where I can add the "715_APP" string?

    thanks!

  • Martin Aguirre 42 posts 210 karma points
    Jun 23, 2017 @ 12:36
    Martin Aguirre
    0

    Well, I could solve this by myself by adding the "media" folder inside IIS as a virtual directory.

  • Martin Aguirre 42 posts 210 karma points
    Jun 29, 2017 @ 13:29
    Martin Aguirre
    0

    Well adding the Virtual Path is no longer an option.

    I've tried the following to get '~ / 718_APP' added to the path that works to read the uploaded entries.

    1. Modify the Umbraco.forms.js file

    This works fine but only for the first item. If there are 2 attachments in the array, the second does not work

    e.g.

    The route that does not work

    http://www.dom.com/media/forms/upload/Form81eb84de-7023-41b8-a2df-10bcf0f5e5fd/518f5e7a-033a-4d34-8379-2a9a99a7d178/Turnos-MunicipalidaddeCrdoba.pdf

    The route that works

    http://www.dom.com/718APP/media/forms/upload/Form81eb84de-7023-41b8-a2df-10bcf0f5e5fd/518f5e7a-033a-4d34-8379-2a9a99a7d178/Turnos-MunicipalidaddeC_rdoba.pdf

    e.g

    this only work for the first item

    http://www.dom.com/718APP/media/forms/upload/Form81eb84de-7023-41b8-a2df-10bcf0f5e5fd/518f5e7a-033a-4d34-8379-2a9a99a7d178/Turnos-MunicipalidaddeCrdoba.pdf, http://www.dom.com/media/forms/upload/Form81eb84de-7023-41b8-a2df-10bcf0f5e5fd/7741c295-4305-48af-9c63-7407de8fd6bc/WebCMSBANCOR-ManualdeUsuario.pdf

    this does not work:

    http://www.dom.com/718APP/media/forms/upload/Form81eb84de-7023-41b8-a2df-10bcf0f5e5fd/518f5e7a-033a-4d34-8379-2a9a99a7d178/Turnos-MunicipalidaddeCrdoba.pdf, http://www.dom.com/718APP/media/forms/upload/Form81eb84de-7023-41b8-a2df-10bcf0f5e5fd/7741c295-4305-48af-9c63-7407de8fd6bc/WebCMSBANCOR-Manualde_Usuario.pdf

       if(schema && entry){
            for (var index = 0; index < schema.length; index++) {
                var schemaItem = schema[index];
    
                //Select the value from the entry.fields array
    
                var valueItem = entry.fields[index];
    
                // Works only 1 time
                //var agregar = '~/718_APP';    
                //var valueItem = agregar + entry.fields[index];
    
    
                //var valueItem = '~/718_APP' + entry.fields[index].replace(', ', ', ~/718_APP');
    
                //Create new object to push into details above (so our angular view is much neater)
                var itemToPush = {
                    name: schemaItem.name,
                    value: valueItem,
                    viewName: schemaItem.view,
                    view: umbRequestHelper.convertVirtualToAbsolutePath('~/app_plugins/umbracoforms/Backoffice/common/rendertypes/' + schemaItem.view + '.html')
                };
    
    1. Now I'm trying to use urlrewriting to redirect

    But I do not know how to parameterize this feature so that it only applies with items of type "entries"

    <add name="Category Rewrite"
      virtualUrl="~/(.*)/718_APP/(.*)/"
      rewriteUrlParameter="IncludeQueryStringForRewrite"
      redirect="Application"
      destinationUrl="~/"
      ignoreCase="true" />
    
  • Martin Aguirre 42 posts 210 karma points
    Jun 29, 2017 @ 18:24
    Martin Aguirre
    0

    Anyone?

  • Martin Aguirre 42 posts 210 karma points
    Jul 03, 2017 @ 12:38
    Martin Aguirre
    100
    angular.module("umbraco").controller("UmbracoForms.RenderTypes.FileController",
        function($scope){
    
    
        var imageExts = ['jpg','jpeg','png','gif','bmp'];
    
        $scope.files = $scope.field.replace('~', '').replace(' ', '').split(',');
    
    
        $scope.AddStr = function (filepath) {   
        var ismedia = false;
        for (var index = 0; index < $scope.files.length; index++)
            { if ($scope.files[index].includes('/media/forms/upload'))              
                ismedia = true;                 
                $scope.files[index] = $scope.files[index].replace(' ','');  
            }               
        if (ismedia) return '..';       
        };
    

    and

    <div class="umb-forms-rendertype-file"
     ng-controller="UmbracoForms.RenderTypes.FileController">
    <div ng-repeat="path in files">
        <div ng-if="path && path.indexOf('.') > 0">
            <a target="_blank" ng-href="{{AddStr(path)+path}}" class="thumbnail" ng-if="isImage(path)">
                <img ng-src="{{getPreview(path)}}" />
            </a>
            <a target="_blank" ng-href="{{AddStr(path)+path}}" class="thumbnail file" ng-if="!isImage(path)">
                <i class="icon icon-document"></i>
                {{getFileName(path)}}
            </a>
        </div>
    </div>
    </div>
    
Please Sign in or register to post replies

Write your reply to:

Draft