The video 'How to Use the File Upload Widget' at https://www.youtube.com/watch?v=iyxGNy5mztk is a good start, but I think it could be more helpful.
It shows using a File Upload widget (which uploads to the SystemRepository on the ThingWorx server), but in the example video, the ThingWorx server is running on the developer's laptop. I would like to see an example that is in an environment more like a real world deployment, where the ThingWorx server is not running on the same laptop from which the file is being uploaded.
In that type of environment, how can I view the contents of a repository, since the repository will not be on my laptop? Can I pull a list of the contents of the SystemRepository (or other repo) out and display in a list widget, like I can with directories on edge devices?
Also, I think a lot of people will be using File Upload not to simply get a file to the SystemRepository, but to push a file all the way down to an edge device. To do this, I had to catch the UploadFailedEvent and then call the FileTransferSubsytem's Copy command. (Not sure why I had to catch UploadFailedEvent, but catching UploadComplete never worked--I never received that event.)
In other words, File Upload only gets a file from your local laptop or device (could be a smartphone or tablet even--basically whatever you are using to view the mashup) up to a repository on the Thingworx server. To get a file onto an edge device, that file must have been uploaded successfully to the server repo, but then the additional necessary step is the FileTransferSubsystem's Copy command. I think it'd be useful to mention that somewhere.
Solved! Go to Solution.
This is a standard piece of content in our Thingworx Fundamentals 101 course.
If you look at the FileRepository Things they come with services to show Directory structure and Files within a Directory.
This is a standard piece of content in our Thingworx Fundamentals 101 course.
If you look at the FileRepository Things they come with services to show Directory structure and Files within a Directory.
Ah, ok. So... I don't need to create a new Thing, but in Composer, upper right side panel, click the green plus sign, choose 'Things', search for SystemRepository, select Things_SystemRepository, choose to display the service GetFileListing service.
Bind the Clicked event of a button to Things_SystemRepository->GetFileListing
Bind 'All Data' to a Grid.
Then clicking the button will retrieve the file listing of everything in SystemRepository and subdirectories.
Thanks!