Example Code

File for WebVI

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • G Web Development Software
  • LabVIEW NXG
  • LabVIEW NXG Web Module

Code and Documents

Attachment

Description

A set of libraries to enable file handling with WebVIs. Files in a web browser behave a bit differently than on desktop. In a web browser the user must explicitly select files to be read by the WebVI and the WebVI can trigger files to be downloaded by the web browser. See a demo of the different capabilities.

 

Supported behaviors:

 

- Read user-selected binary / text files

- Download binary / text files

- Read pictures from a webcam or from a file

- Base64 Encoding and Decoding as well as helpers to make data urls

- Capture image snapshots of elements on the page such as controls as a file (Note: Safari may only have partial support)

- HTTPExtensions to support POST Multipart and GET file responses (Requires G Web Development Software 2022 Q3 or later)

- SystemLinkFileExtensions to support the SystemLink File API (Requires G Web Development Software 2022 Q3 or later)

 

Make sure to include all the Library gcomp's in your application and place them on the Web Server target. The FileTasks.gcomp contains some high-level tasks to handle common operations such as reading a text file as a string, reading a binary file as a byte array, etc.

 

photo.jpg

 

photo.jpg 

 

photo.jpg

 

photo.jpg

 

photo.jpg

(Note: Safari may only have partial support for snapshots)

 

Extensions for the HTTP VIs (requires G Web Development Software 2022 Q3 or later):

Screenshot 2022-08-02 22.52.43.png

 

Screenshot 2022-08-02 22.52.52.png

 

Extensions for SystemLink File VIs (requires G Web Development Software 2022 Q3 or later):

Screenshot 2022-08-02 22.53.00.png

 

Screenshot 2022-08-02 22.53.10.png 

 

Changelog

Release 8 - Breaking Change: HTTPExtensions library now supports the HTTP Client handle. Requires G Web Development Software 2022 Q3 or later. Added File Transfer Extensions palette to support the SystemLink File services.

Release 7 - Add HTTPExtensions library with the Post Multipart Ex - String VI to enable HTTP Post messages of type multipart/form-data to HTTP servers.

Release 6 - Snapshot bugfix to support more control types, specifically a Tab containing a Graph and legends.

Release 5 - Modified snapshot Safari disclaimer. Snapshot seems to have at least partial support in the latest Safari.

Release 4 - Enable support for snapshots using the Get Image VI

Release 3 - Support for G Web Development Software 2021

Release 2 - Enable support for Base 64 Decoding large strings and add Create Data URL VI

Release 1 - Initial release

 

 


Milan

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
T.Minami
NI Employee (retired)
on

Thanks for providing these samples, MilanR!

Any chance these would be available for NXG 4.0 as well?

MilanR
Active Participant
Active Participant
on

This version of the library is heavily dependent on the JavaScript References feature made available starting in NXG 5. It's recommended to use G Web Development Software 2021 if possible.


Milan
Desruelle_luc
Trusted Enthusiast Trusted Enthusiast
Trusted Enthusiast
on

Thanks for providing these samples, MilanR!

banniere Luc Livre NXG Champion.png

Luc Desruelle | Mon profil | Mon blog LabVIEW | Auteur livre LabVIEW : Programmation et applications - G Web
Certified LabVIEW Architect (CLA) & Certified TestStand Developper (CTD) | LabVIEW Champion

MESULOG - LinkedIn site | NERYS - NERYS Group
| directeur CEO MESULOG
| CODIR - NERYS group

ulf.hirsekorn@hotmail.de
Member
Member
on

Hi MilanR,

Nice work! Any chance to publish a version which works with the actual Community Version of NXG5.1...? If i try to use your release 5 i get the failure message that NXG version is newer from your files. There is actually no update of the NXG5.1 Community to your version...?!

Thanks and best regards,

Ulf

MilanR
Active Participant
Active Participant
on

Hi Ulf,

 

Starting with release 3 this project switched to G Web Development Software which is a standalone version of the LabVIEW NXG Web Module.

G Web Development Software does have a community version as well and it includes a tool to migrate projects from LabVIEW NXG Web Module.

 

I'd encourage switching to G Web Development Software if you would like to use releases >= 3 of this example.

 


Milan
Contributors