Download a file hosted on an NI web server using the HTTP method using LabVIEW

Updated Jul 18, 2022

Environment

Software

  • LabVIEW

This article will show you how to host any file on your NI web server and download the file hosted on your NI web server with a program that uses HTTP methods created in LabVIEW. We will use LabVIEW and the NI web server here. The NI Web Server can be installed by installing LabVIEW. If you use the HTTP method to download a file from a PC other than the one hosting the file on the NI Web server, you need to set up a network that allows HTTP communication on port 80.

First, configure the NI web server. Here, we use a PC that exists in a trusted network isolated from the outside, and use "non-secure remote access".



After the above settings, set a password and confirm or end the settings to complete the NI Web server settings. Then move the file hosted on the NI web server to the path below.
C: \ Program Files \ National Instruments \ Shared \ Web Server \ htdocs


Here I moved the file test.zip to htdocs. To download this test.zip using the HTTP method, create a VI like the one below.



We will use GET here. Enter the absolute path of the file to be saved in the input terminal of "Output file" of GET. In this example, the file moved to htdocs (the file hosted by the NI web server) is test.zip, and the IP address of the PC on which the NI web server is running is 10.128.1.91, so the URL Write the URL information to the input terminal like http: //0.128.1.91/test.zip. If you execute the VI in this state, test.zip will be saved with the name specified in the input terminal of the "output file".