Copied to clipboard

Flag this post as spam?

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


  • Ali Sheikh Taheri 459 posts 1604 karma points c-trib
    Oct 14, 2013 @ 14:38
    Ali Sheikh Taheri
    0

    CogFiltered Upload with contour 3

    Hi

    I am using Umbraco 6.1.6 with Contour version 3.

    I've also added CogFiltered upload datatype to contour to restrict file extensions for file upload. when the form is loaded I am getting the below error:

    The partial view '/umbraco/plugins/umbracoContour/Views/Fieldtype.cogfilteredupload.cshtml' was not found or no view engine supports the searched locations. The following locations were searched: /umbraco/plugins/umbracoContour/Views/Fieldtype.cogfilteredupload.cshtml
    

    I know I've to add a view but dont know what sort of code I've to have in the view.

    any help is much appreciated!

    Thanks

    Ali

  • Ismail Mayat 4328 posts 9331 karma points MVP 2x admin c-trib
    Oct 14, 2013 @ 15:43
    Ismail Mayat
    1

    Ali,

    I thought I had uploaded the source for this on the project home page, however looks like i have not. Can you speak to anyone from cogworks and see if they can put the source up into bitbucket. Some of the other offerings from cogworks are already up there so i'm sure if will be fine. Is that file missing when you check the location /umbraco/plugins/umbracoContour/views ?

    Regards

    Ismail

  • Ali Sheikh Taheri 459 posts 1604 karma points c-trib
    Oct 14, 2013 @ 15:45
    Ali Sheikh Taheri
    0

    yes that file is missing. who shall I contact Warren?

    Thanks

    Ali

  • Adam Shallcross 46 posts 191 karma points MVP c-trib
    Oct 14, 2013 @ 16:25
    Adam Shallcross
    0

    I'll ask and let you know...cheers

  • Ali Sheikh Taheri 459 posts 1604 karma points c-trib
    Oct 14, 2013 @ 16:51
    Ali Sheikh Taheri
    102

    I've created the following view under "/umbraco/plugins/umbracoContour/views" and everything works like a charm.

    @model Umbraco.Forms.Mvc.Models.FieldViewModel
    @{
        var allowedExtensinos = Model.AdditionalSettings.FirstOrDefault(x => x.Key == "AllowedExtensions").Value;
    }
    
    <input type="file" name="@Model.Name" id="@Model.Id"
    @if(Model.Mandatory){<text> data-val="true" data-val-required="@Model.RequiredErrorMessage"</text>}
    @if(!string.IsNullOrEmpty(allowedExtensinos)){<text> data-val="true" data-val-regex="Invalid file type!" data-regex="@allowedExtensinos"</text>}
    />
    
    @if (!string.IsNullOrEmpty(Model.Value))
    {
     <br />
     <a href="@Model.Value" target"_blank">Show current file</a>
     <input type="hidden" name="@{@Model.Name}_file" value="@Model.Value"/>
    }
    
  • Ali Sheikh Taheri 459 posts 1604 karma points c-trib
    Oct 15, 2013 @ 10:31
    Ali Sheikh Taheri
    0

    Thanks a lot to Ismail for helping me to find the solution.

    Cheers

    Ali

  • Ismail Mayat 4328 posts 9331 karma points MVP 2x admin c-trib
    Oct 16, 2013 @ 16:15
    Ismail Mayat
    0

    Ali,

    Thanks for sharing your code. I think I only ever used this field type in webforms contour and not mvc contour however looks like you have sorted it.

    Regards

    Ismail

  • keilo 558 posts 1013 karma points
    Jun 24, 2014 @ 12:34
    keilo
    0

    Hi Ali

    I have tried adding your code to the counter views folder but it doesnt seem to work on v71.4 sql with latest contour.

    Is there any update to it, or any other aspect that needs to be configured?

    cheers

  • JLon 316 posts 458 karma points
    Jun 30, 2015 @ 15:29
    JLon
    0

    Any update on this as well? Looking to do the same thing with Umbraco V7.2.6 Forms

    Thanks

  • keilo 558 posts 1013 karma points
    Sep 10, 2015 @ 17:48
    keilo
    0

    Got this to work (partially) on latest Contour with Umbraco 7.

    I have given this another try, downloading the source of the cogfilteredupload from https://our.umbraco.org/projects/backoffice-extensions/cogworks-cogfilteredupload/

    and changing the reference of umbraco.forms.core and recompiling for .NET 4.5.1, i move the dll to the bin folder.

    then created the ..umbracoContour/views/FieldType.cogfilteredupload.cshtml

    with the code posted above.

    It then renders the upload form, on latest Contour, Umbraco version 7.

    However on a Contour form, with datatype set to cogworksfilteredupload and the regex field set to ^.+.((jpg)|(gif)|(jpeg)|(png))$

    it doesnt seem to work; i.e. it allows to upload any file type - no validation seems to be taking place?

    Is there something else I might be missing?

Please Sign in or register to post replies

Write your reply to:

Draft