6 Replies Latest reply on Mar 2, 2016 4:48 AM by ss RSS
    lwei Explorer

    Upload & Download File

    Hey, guys!

     

    I'm working on a project lately, and I need to work on a mashup that can upload and download files(.jpg .zar .mp3).

     

    I know that there is a widget called Upload file, but there are no download widget.

     

    How can I download a file from the Thingworx??

      • Re: Upload & Download File
        stevegr Explorer

        Lee,

        If you created upload Mashup then its just a few steps to get download to work.

        Your Thing I expected used the Template of FileRepository (Which we will call MyRepo)

        That things has Services you can use called GetDirectoryStructure which I expect you used. You can also use GetFileListingWithLinks. Wire the services up connecting selected rows path from the GetDirectoryStructure to Parameters of the GetFileListingWithLinks. From the UI you can use the Link in the Grid to download the file.

         

        Note: In your File upload Mashup you would of set the RepositoryName to "MyRepo" in the FileUpload Widget which connects the Services to the UI

         

        Hop this helps

         

        filetransfer.PNG

          • Re: Upload & Download File
            lwei Explorer

            Thanks a lot, it worked!!!

            • Re: Upload & Download File
              ss Explorer

              I am following the steps you have mentioned , but not able to replicate as you have mentioned....

               

              Please guide me, find the steps I followed...

               

              1. I have a thingWorx cloud instance(xxxx.cloud.thingworx.com). My objective is to upload the file  into file repository, view the absolute path and later download.

              2. I created a thing (thingFileUpload) with thing template as FileRepository

              3, Then created a mashup (created a widget FileUpload) , In the properties of fileUpload widget, selected the repository name as thing name(thingFileUpload).

              4. Clicked on + symbol to add the entity.

              5. Typed the thing name(thingFileUpload) and selected services : GetDirectoryStructure and GetFileListingWithLinks.

              6. Wired up the services - path of selected row of GetDirectoryStructure to path of parameters of GetFileListingWithLinks

              7.Then saved and clicked on view mashup button.. but I dont see better than this and on upload nothing happens. Please guide me...

               

              Do I need to act extra widgets?Please guide me.Thanks in advance.....

            • Re: Upload & Download File
              byutz Apprentice

              Thanks for this helpful post!  Is there anyway to download data using this method?  I tried to export data from a value stream to my repository, but it doesn't show up in the grid to download.  All other files in my repository show up.  Thanks!

                • Re: Upload & Download File
                  byutz Apprentice

                  I just figured it out.  You first need to use GetDirectoryStructure and feed it into a grid, then you can feed your selected row into the GetFileListingWithLinks service and in another grid your data stream or whatever you have exported will show up there and you can use the download link!  I am sure this is not a "best practice"  but if you do not have rdp access to your instance, this is a quick way to get data directly.