2 Replies Latest reply on Dec 7, 2016 11:26 AM by jamesm RSS
    Digital One Explorer

    How to set the uploaded image in Thing property?



    I am using File Upload Widget to select an image and upload it.

    The selected image is stored at repository.

    I wanted to save the image to thing property which as the base type as "IMAGE LINK".

    is there any way?


    Thanks in advance!

      • Re: How to set the uploaded image in Thing property?
        supandey Collaborator

        Hi you could try with the File Repository's service called GetFileInfo in fact there are bunch of other services for getting the directory structure together with files and their download links. I believe you can either use one of those or just modify the one you feel appropriate to get the full path of a specific image stored in repository which can then be pushed to IMAGE LINK.


        You might want to explore the generic services in FileRepositoryThing (ThingWorx Platform API 7.1.0)

          • Re: How to set the uploaded image in Thing property?
            jamesm Creator

            I think the IMAGELINK base type will only work for media entities. You will need to use the IMAGE base type, and get the raw base64 data from the image in the file repository to set as the image value.


            Edit: You can do this by getting the image link from the repo as Sushant recommended (there is a standard url path: something like /Thingworx/FileRepositoy/FileRepoName/Path/Image.png, I think) and then using the LoadImage function:




            var params = {

                url: "IMAGEURL IN FILE REPO"




            // result: STRING

            me.PROPERTYNAME = Resources["ContentLoaderFunctions"].LoadImage(params);