From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

WebVI Upload PDF

Solved!
Go to solution

I am trying to transfer a pdf from a web vi to the server (the server will be running labview web services). The user will select the pdf of interest from their PC to upload to the server. Has anyone had any luck transfering a binary file from a web vi

0 Kudos
Message 1 of 8
(1,837 Views)

Hi Mike,

 

Could you try this library/example and see if it works for your use case? There's some discussion regarding this library in this thread.

Sujay Narayana
Principal Software Engineer
0 Kudos
Message 2 of 8
(1,770 Views)

Hi Sujay,

 

I tried that, it works well with ascii files but I cant get it to work with binary files like pdfs.

 

Michael

0 Kudos
Message 3 of 8
(1,763 Views)

I was just looking at the code in the UploadFileToWebVI.js, and it looks like it's returning the file content in the form of text (Line 70). I'm guessing that might be the cause of the issue. One idea I can think of is to return response.blob() instead of response.text().

Sujay Narayana
Principal Software Engineer
0 Kudos
Message 4 of 8
(1,760 Views)

Thanks for the suggestion. I have tried changing to blob from text but unfortunately when I run it the error message I get is "An unhandled error occured on the LabVIEW diagram with code 44306 at <APPEND>"

0 Kudos
Message 5 of 8
(1,752 Views)

I found a link that shows how to get it working in NXG:

 

https://github.com/rajsite/webvi-experiments/tree/master/File

Message 6 of 8
(1,681 Views)
Solution
Accepted by topic author Mike1979

Hi Mike1979,

 

I was just cleaning up that example a few days ago to share on here. For future users I posted the example on the NI Example Code forum at the following URL: https://forums.ni.com/t5/Example-Code/File-for-WebVI/ta-p/4129229

 

That would be a good place to download the library for File handling in WebVIs and to ask questions, etc.

 


Milan
Message 7 of 8
(1,657 Views)

Hi Milan

 

Thanks for that. It looks great!

 

Michael

0 Kudos
Message 8 of 8
(1,649 Views)