com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_link3' is unknown.

Transferring Files

WSO2 IoT Server enables you to upload and download files from Android devices. You need to set up a shared location to manage the files that are sent to the device and the files that are sent from the device to WSO2 IoT Server. The server sends an operation to the device to send the requested file to the defined shared location. Similarly, if a file needs to be sent to the device, the server sends an operation to the device to get the file from the shared location.

Let's take a look at how it works:

Before you begin

  • Make sure to have an Android device enrolled. For more information, see Android.
  • Set up a shared location to manage the files that need to be sent to the device and the files that are downloaded from the device. The shared location can have the HTTP, FTP, and SFTP transfer protocols.

Uploading files to the device

Follow the steps below to upload a file to your Android device:

  1. Access the device management console at https://<IOTS_HTTPS_HOST>:9443/devicemgt and sign in as an administrator. The default username is admin and the default password is admin.
  2. Click View under the DEVICES tile.
  3. Click the device thumbnail and navigate to the device details page.
  4. Click File Transfer. 
  5. Select the To device option. 
  6. Enter the details to upload a file to the device:
    1. Select the preferred transfer protocol, such as HTTP, FTP, or SFTP.
    2.  Enter the shared location where the file is stored in one of the following formats:
      • For HTTP: <HTTP_URL>
      • For FTP: FTP://<USER_NAME>@<HOST_NAME>/<FOLDER_PATH>/<FILE_NAME>
      • For SFTP: SFTP://<USER_NAME>@<HOTS_NAME>/<FOLDER_PATH>/<FILE_NAME>
    3. Optionally, enter the location on the device to save the file. It is recommended to provide the location. 
      • The file path needs to be in the following format: /<DIRECTORY>/<DIRECTORY>. For example,  /sdcard/Donwload/.
      • If the location is not defined, the file is saved to the download directory of the device. On some devices, the files are saved in the file explorer's download directory. 
    4. Optionally select Authentication required if your shared location is secured using credentials, and enter the username and password for a secure transfer.

      If you are using the FTP or SFTP protocols to transfer files and if the username is part of the file URL the Username field is automatically updated using the data from the File URL field.

      Example:

      It is optional to enter the password. Certain FTP accounts do not require passwords for authentication. In such scenarios, you can leave the password field empty.
  7. Click Send to Device.
    You can see the FILE_UPLOAD_TO_THE_DEVICE entry immediately changing to the PENDING state in the Operations Log. After the file is successfully uploaded to the device, the FILE_UPLOAD_TO_THE_DEVICE entry changes to the COMPLETED state.

    If the file size is large, it takes a few minutes for the file to download to the device based on your network condition.

    Example: Successfully completing the operation:

Downloading files from the device

Follow the steps below to download a file from your Android device:

  1. Click File Transfer. 
  2. Select the From device option. 
  3. Enter the details to download a file from the device:
    1. Select the preferred transfer protocol, such as HTTP, FTP, or SFTP.
    2.  Enter the shared location path where the file needs to be saved to:
      • For HTTP: <HTTP_URL>
      • For FTP: FTP://<USER_NAME>@<HOST_NAME>/<FOLDER_PATH>
      • For SFTP: SFTP://<USER_NAME>@<HOTS_NAME>/<FOLDER_PATH>
    3. Enter the exact location of the file in the device that needs to be sent to the shared location. If the file path is wrong, the operation is terminated.
      The file path needs to be in the following format: /<DIRECTORY>/<DIRECTORY>/<FILE_NAME>. For example,  /sdcard/Donwload/fileName.pdf.
    4. Optionally, select Authentication required if your shared location is secured using credentials, and enter the username and password for a secure transfer.

      If you are using the FTP or SFTP protocols to transfer files  and if  the username is part of the file URL the Username field is automatically updated using the data from the File URL field.

      Example:

      It is optional to enter the password. Certain FTP accounts do not require passwords for authentication. In such scenarios, you can leave the password field empty.
  4. Click Send to Device.
  5. A notification is sent to the device asking the device to share the file with WSO2 IoT Server. The device owner needs to Allow this request. Once allowed, the file is sent to the shared location.

    You can see the FILE_DOWNLOAD_TO_THE_DEVICE entry immediately changing to the PENDING state in the Operations Log. Once the file is successfully sent to the defined shared location the FILE_DOWNLOAD_TO_THE_DEVICE entry changes to the COMPLETED state.

    If the file size is large, it takes a few minutes for the file to download to the shared location based on your network condition.


    Initially, the file is not there in the shared location you defined. Once the operation is completed you see the file you sent from the device downloaded to the directory.

Failing to transfer files

If you enter the wrong username and password for the shared location credentials, enter an incorrect file path, or if you don't allow the device to share the file when the notification is sent to the device, the file transfer operation is terminated. This is indicated in the Operations Log as an ERROR.

Example: The Operations Log when the device owner cancels the file share request.

com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links2' is unknown.