Transfer Files Using the FTP Protocol With LabVIEW

Updated Mar 9, 2022

Reported In

Hardware

  • CompactRIO Controller

Software

  • LabVIEW Real-Time Module

Issue Details

How can transfer files to and from an FTP server or a real-time target such as compactRIO using LabVIEW? 

Solution

There are two ways to programmatically put or get files via FTP using LabVIEW:
  1. It is recommended to use the built-in FTP VIs (this requires the Internet Toolkit for versions of LabVIEW prior to 2012). An example of how to pt and get files using the FTP protocol can be found in the Example Finder by opening LabVIEW and going to Help >> Find Examples... >> Networking >> FTP >> FTP Put and Get Files.vi. Below there is a code example of how to get the files from a real-time target. 
  1. An alternative method is to use the System Exec VI. For reference take a look at the "Use the command-prompt FTP client" section of this article: How Can I Transfer Files to an FTP Server?

Additional Information

  • When using the provided FTP VI example use the following values
    • For real-time targets the default user name is anonymous and password is an empty string. If you receive error 15530, you may have an incorrect user name and/or password.
    • The host is the IP address of the real-time target.
  • Make sure to designate a file name on both the remote path and the local path.