Download a File Hosted on NI Web Server Using HTTP Method in LabVIEW

Updated Mar 29, 2024

Environment

Software

  • LabVIEW

This document explains how to host any file on NI web server and download the file using HTTP methods in LabVIEW.  NI Web Server can be installed when installing LabVIEW. If you want to use 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.

  1. First, configure the NI web server. In this example, we use a PC that exists in a trusted network isolated from the outside, so we set the server preset to Insecure remote access.

ni web2.PNG
  1.  Set a password and proceed to complete the NI Web server configuration.
  2. Move the file you want to download in the folwing folder. All files in this folder are automatically hosted on the NI web server.
C:\Program Files\National Instruments\Shared\Web Server\htdocs

In this example test.zip  was moved to to htdocs.
ni web3.PNG
To download this test.zip using the HTTP method, create a VI like the one below.
  1. Drop GET VI on the block diagram. The HTTP GET VI  can be found on Functions >> Data Communication >> Protocols>>HTTP Client palette
ni web4.PNGni web6.PNG
  1. Click on output file terminal and select Create a Constant. 
  2. Enter the absolute path of where you want the file to be saved. This example will download test.zip (the file hosted on NI web server, htdocs)
  3. On the url terminal,  input the is the IP address of the PC on which the NI web server is running is 192.168.1.16.  You can check it on NI web Server Configuration. Write the URL follow by the name of the file as below
ni web5.PNG