6 Replies Latest reply on Jul 31, 2017 2:50 PM by jdass RSS
    ds-2 Apprentice

    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

      • Re: is Possible to FileTransfer from local to repository?
        polinao Collaborator

        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.

        • Re: is Possible to FileTransfer from local to repository?
          supandey Collaborator

          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

          • Re: is Possible to FileTransfer from local to repository?
            ytella Apprentice

            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