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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

is Possible to FileTransfer from local to repository?

ds-21
7-Bedrock

is Possible to FileTransfer from local to repository?

Hi,

      is possible to copy file from local drive (D:/Dinesh/abc.zip) to thingworx Repository through FileTransferSubsystem Copy service.

Regards,

Dinesh S

6 REPLIES 6
posipova
20-Turquoise
(To:ds-21)

There’s a few pieces you need in place to do a file transfer. Transfers can be executed in either direction: edge->platform or platform->edge.  To do a transfer the edge component must be configured with a set of virtual directories.  For the EMS, the configuration section would look like this:

"file": {

    "virtual_dirs":[

      { “In" : "./in" },

      { “Out": "./out" },

      { "staging": "./staging" }

    ],

    "staging_dir": “staging"

}

This is important because you will need to virtual dir names in the parameters to the Copy call.  In the above example assumes that there are three directories in the same location as the EMS executable: ‘in’, ‘out’, ‘staging’.  You can specify absolute paths as well.

For the example I’m about to give, assume the following:

  • A RemoteThingWithFileTransfer named RT1.
  • That the files are being transferred to/from the SystemRepository thing.
  • That the EMS is installed in C:\Microserver and that C:\Microserver\in, C:\Microserver\out, and C:\Microserver\staging exist.
  • The source file is located in the ‘files’ directory of the SystemRepository

In this case, the Copy parameters, for a transfer from the Platform to the Edge would be:

sourceRepo: SystemRepository  // Name of the Thing to transfer from

targetRepo: RT1 // Name of the Thing to transfer to

sourcePath: /files      // Directory in the SystemRepository

targetPath: /In        // The name of a virtual dir. In this case it is pointing to C:\Microserver\in. You can also specify subdirs.

sourceFile: abc.json

targetFile: abc.json    // Optional. The default is the sourceFile name. You can rename files during the transfer

Note that the Things must be instances of one of the following templates: FileRepository, RemoteThingWithFileTransfer, RemoteThingWithFileTransferAndTunneling. You can add an auto_bind entry to your config.json to specify the name of a Thing that will participate in file transfers:

"auto_bind”: [

      { “name”: “RT1” }

]

  Hopefully this helps.

dsenthil
2-Explorer
(To:posipova)

but i need without remote or edge. i have local drive to repository

thanks

supandey
19-Tanzanite
(To:ds-21)

Dinesh, just to add to what Polina already mentioned you can also check the FTP Extension from ThingWorx Marketplace for moving files to and fro from the file system

ytella
17-Peridot
(To:ds-21)

Hi Dinesh,

To add to what Polina and Sushant mentioned, you can also copy files from local drive to thingworx repository as follows:

  1. Create a file repository thing.(you should use FileRepository template in Thing template field)
  2. Create a responsive mashup and add file upload widget.
  3. In the properties panel, click the SystemRepository in the RepositoryName field.
  4. Click the clear button.
  5. Select the thing you have created in the RepositoryName field.
  6. Clear the DisplayRepository check box.
  7. Save and test the mashup.

In the mashup, you can choose a file from local machine and upload it in the ThingWorxStorage--> Repository

dsenthil
2-Explorer
(To:ytella)

for my use case. it should use COPY service in FileTransferSubsystem

jdass
13-Aquamarine
(To:dsenthil)

The File Transfer Subsystem manages file transfers between Remote Things, File Repositories, and Federated Servers. Like Polina had mentioned , transfers can be executed in either direction: edge->platform or platform->edge. There needs to be some websocket connection to facilitate the file transfer . In your case , to transfer a file from a local drive to a repository the only work around would be to use the file upload widget as mentioned by Yamini.

Announcements


Top Tags