+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Module Builder: Programmatically upload and associate image file

Module Builder: Programmatically upload and associate image file

2 posts, 0 answered
  1. Randy Garza
    Randy Garza avatar
    19 posts
    Registered:
    24 Feb 2012
    22 Jan 2014
    Link to this post
    Hi,

    I've created a custom module using Module Builder. This custom module includes a field for uploading an image. I  have created a custom ascx user control that will save items to the new custom module, except for the uploaded image. Is there any documentation related to saving images using the custom module builder types via custom code? I did find documentation on creating images in the library but there is no reference on how to associate the uploaded image with a content item.

    thanks

    Sitefinity version 6.0
  2. Stefani Tacheva
    Stefani Tacheva avatar
    718 posts
    Registered:
    21 Nov 2016
    27 Jan 2014
    Link to this post
    Hello,

    You have the ability to add a custom field for your custom module of type Media (images, videos, files).

    http://screencast.com/t/CtpFIpJ2

    Then choose what kind of media this field will manage and save the changes. If you have a pop up which asks you

    Are you sure you want to save the changes to this content type?


    Check Update widget templates as well and click Yes, save the changes.

    After that when you create an item of the module you will have an image selector:

    http://screencast.com/t/iisji3mRdO

    This is how you should associate an item with an image.

    After the item is created and the widget is dropped on the page, you could see the item and the image in the details view of the item. The field is added automatically to the details template.

    http://screencast.com/t/3DvAwC1L


    If you want to add it to the list template you need to go to the properties of the widget, navigate to List settings, choose the template and add the AssetsField there (copy it from the details template).

    Regards,
    Stefani Tacheva
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered