Upload File Programmatically to LabVIEW Web Service

Updated Jan 7, 2026

Environment

Software

  • LabVIEW

LabVIEW Web Service enables users to interact with an application via web services, including uploading and downloading files to and from the web server, respectively. In this article, we will be demonstrating how to set up LabVIEW Web Service to handle uploaded file(s) and how to design a VI to upload a file to LabVIEW Web Service.

Hosting LabVIEW Web Service

  1. Launch LabVIEW.
  2. Create a LabVIEW project and save it. For demonstration purposes, the LabVIEW project will be saved as File Service.lvproj.
  3. Right-click My Computer and select New>>Web Service.
  4. Save the newly created Web Service. For demonstration purposes, the Web Service will be saved as FileService.
  5. Right-click Web Resources and select New VI.
  6. Save the VI as FileUpload.vi.
  7. Change the HTTP method for FileUpload.vi from GET to POST.
  8. Design the block diagram of the FileUpload.vi as follows. It will save the uploaded file to user desktop:
        
    Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.

  9. Save the FileUpload.vi.
  10. LabVIEW Web Service can be hosted in NI Web Server or Application Web Server. Steps below demonstrate how to host the web service in NI Web Server and Application Web Server:
    • Using NI Web Server
      1. Ensure LabVIEW is launched with Administrator privileges.
      2. Right-click the Web service project item in the project tree and select Start.
      3. Click OK if the following pop-up appears:
      4. Right-click FileUpload.vi and select Show Method URL.
      5. Click Copy URL to save the URL to the clipboard so we can upload file(s) to this URL later.
      6. Proceed to VI to Upload File section.
    • Using Application Web Server 
      1. Right-click the Web service project item in the project tree and select Application Web Server>>Publish.
      2. Click Close once the deployment progress is completed:
      3. Right-click FileUpload.vi and select Show Method URL.
      4. Click Copy URL to save the URL to the clipboard so we can upload file(s) to this URL later.
      5. Proceed to VI to Upload File section.

 

VI to Upload File

  1. Create a new VI. For demonstration purposes, the VI will be saved as UploadFile.vi under My Computer of the File Service.lvproj.
  2. Design its block diagram as follows to upload file(s) to LabVIEW Web Service:
     
  3. Use the following value for the controls at its front panel:
    • url                         : HTTP Method URL copied in the previous section
    • data >> File          : The full filepath of the to-be-uploaded file
    • data >> Filename : The new filename of the to-be-uploaded file when saved on the server
  4. Run the VI and observe that the uploaded file is now renamed and saved to the user's desktop.