Copied to clipboard

Flag this post as spam?

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


  • Brock 2 posts 22 karma points
    Jul 29, 2015 @ 19:31
    Brock
    0

    Configuring Datatypes: "File Upload"

    I am working in Umbraco 7. I am attempting to use the Datatype: File Upload in an existing template. I have created a custom data type and I have also applied the datatype to the Document Type . I am sure how to go about applying the Datatype to the template so that when an image is uploaded in the content section, it appears in the rendered version of the template when previewed or published.

    If anyone can provide assistance I would greatly appreciate your time and consideration.

    Thanks.

  • Dennis Aaen 4492 posts 18198 karma points admin hq c-trib
    Jul 29, 2015 @ 21:26
    Dennis Aaen
    0

    Hi Brock,

    Try to have a look at this documentation on how to get the data from the upload datatype

    https://our.umbraco.org/documentation/using-umbraco/backoffice-overview/property-editors/built-in-property-editors/Upload

    If you are using Umbraco 7. Then just use the MVC View Examples called strongly typed Razor or dynamics Razor.

    Strongly typed Razor

    @{      
       if (Model.Content.HasValue("umbracoFile")){
           <img src="@Model.Content.GetPropertyValue("umbracoFile")" />
       } 
    }
    

    Dynamic Razor

    @{      
       if (CurrentPage.HasValue("umbracoFile")){
            <img src="@CurrentPage.umbracoFile" />
       } 
    }
    

    Hope this helps,

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft