cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Upload & Download File

lwei
1-Newbie

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??

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

7 REPLIES 7

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

Thanks a lot, it worked!!!

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.....

ss1
1-Newbie
1-Newbie
(To:ss1)

Thanks that worked... I missed to add the grid in the mashup layout.... Now its set and done

Thanks a lot ! This worked for me ! 

byutz
1-Newbie
(To:lwei)

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!

byutz
1-Newbie
(To:byutz)

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.

Top Tags